home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / General / XLisp 2.1e3 / xlisp docs < prev   
Text File  |  1992-10-29  |  199KB  |  5,239 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.                   XLISP-PLUS: Another Object-oriented Lisp
  17.  
  18.                                 Version 2.1e
  19.  
  20.                              September 11, 1992
  21.  
  22.                                   Tom Almy
  23.                               tom.almy@tek.com
  24.  
  25.  
  26. Portions of  this manual and software are from XLISP which is Copyright (c)
  27. 1988,  by  David  Michael  Betz,  all  rights  reserved.  Mr.  Betz  grants
  28. permission for unrestricted non-commercial use. Portions of XLISP-PLUS from
  29. XLISP-STAT are Copyright (c) 1988, Luke Tierney. UNIXSTUF.C is from Winterp
  30. 1.0,  Copyright  1989  Hewlett-Packard  Company  (by  Niels  Mayer).  Other
  31. enhancements  and bug fixes are  provided without restriction  by Tom Almy,
  32. Mikael  Pettersson,  Neal  Holtz,  Johnny Greenblatt,  Ken  Whedbee,  Blake
  33. McBride, and Pete Yadlowsky. See source code for details.
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. Table of Contents
  44.  
  45. INTRODUCTION  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   1
  46.  
  47. XLISP COMMAND LOOP  . . . . . . . . . . . . . . . . . . . . . . . . . .   2
  48.  
  49. BREAK COMMAND LOOP  . . . . . . . . . . . . . . . . . . . . . . . . . .   4
  50.  
  51. DATA TYPES  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   5
  52.  
  53. THE EVALUATOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   7
  54.  
  55. HOOK FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . . . . . .   8
  56.  
  57. LEXICAL CONVENTIONS . . . . . . . . . . . . . . . . . . . . . . . . . .   9
  58.  
  59. 8 BIT ASCII CHARACTERS  . . . . . . . . . . . . . . . . . . . . . . . .  11
  60.  
  61. READTABLES  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  12
  62.  
  63. SYMBOL CASE CONTROL . . . . . . . . . . . . . . . . . . . . . . . . . .  14
  64.  
  65. LAMBDA LISTS  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  16
  66.  
  67. OBJECTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  18
  68.  
  69. SYMBOLS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  22
  70.  
  71. EVALUATION FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . . .  24
  72.  
  73. SYMBOL FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . . . . .  26
  74.  
  75. PROPERTY LIST FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . .  30
  76.  
  77. HASH TABLE FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . . .  31
  78.  
  79. ARRAY FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . .  32
  80.  
  81. SEQUENCE FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . . . .  33
  82.  
  83. LIST FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  38
  84.  
  85. DESTRUCTIVE LIST FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . .  42
  86.  
  87. ARITHMETIC FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . . .  43
  88.  
  89. BITWISE LOGICAL FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . .  48
  90.  
  91. STRING FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . . . . .  49
  92.  
  93. CHARACTER FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . . .  51
  94.  
  95. STRUCTURE FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . . .  53
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103. XLISP 2.1e                   Table of Contents
  104.  
  105.  
  106. OBJECT FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . . . . .  55
  107.  
  108. PREDICATE FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . . .  57
  109.  
  110. CONTROL CONSTRUCTS  . . . . . . . . . . . . . . . . . . . . . . . . . .  61
  111.  
  112. LOOPING CONSTRUCTS  . . . . . . . . . . . . . . . . . . . . . . . . . .  64
  113.  
  114. THE PROGRAM FEATURE . . . . . . . . . . . . . . . . . . . . . . . . . .  65
  115.  
  116. INPUT/OUTPUT FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . .  67
  117.  
  118. THE FORMAT FUNCTION . . . . . . . . . . . . . . . . . . . . . . . . . .  69
  119.  
  120. FILE I/O FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . . . .  71
  121.  
  122. STRING STREAM FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . .  75
  123.  
  124. DEBUGGING AND ERROR HANDLING FUNCTIONS  . . . . . . . . . . . . . . . .  77
  125.  
  126. SYSTEM FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . . . . .  79
  127.  
  128. ADDITIONAL FUNCTIONS AND UTILITIES  . . . . . . . . . . . . . . . . . .  84
  129.  
  130. BUG FIXES AND EXTENSIONS  . . . . . . . . . . . . . . . . . . . . . . .  88
  131.  
  132. EXAMPLES: FILE I/O FUNCTIONS  . . . . . . . . . . . . . . . . . . . . .  96
  133.  
  134. INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  98
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142. XLISP 2.1e                      INTRODUCTION                         Page 1
  143.  
  144.  
  145.  
  146.  
  147. INTRODUCTION
  148.  
  149. XLISP-PLUS is  an enhanced  version of David  Michael Betz's XLISP  to have
  150. additional  features of Common Lisp. XLISP-PLUS is distributed for the IBM-
  151. PC family  and for  UNIX,  but can  be easily  ported  to other  platforms.
  152. Complete source  code is proved  (in "C")  to allow  easy modification  and
  153. extension.
  154.  
  155. Since XLISP-PLUS is based on XLISP,  most XLISP programs will run on XLISP-
  156. PLUS. Since XLISP-PLUS incorporates many more features of Common Lisp, many
  157. small  Common  Lisp   applications  will  run  on  XLISP-PLUS  with  little
  158. modification.  See  the section  starting  on page  88  for details  of the
  159. differences between XLISP and XLISP-PLUS.
  160.  
  161. Many  Common Lisp functions are  built into XLISP-PLUS.  In addition, XLISP
  162. defines the objects  'Object' and  'Class' as primitives.  'Object' is  the
  163. only  class that  has no  superclass and  hence is  the root  of  the class
  164. heirarchy tree. 'Class' is the class of which all classes are instances (it
  165. is the only object that is an instance of itself).
  166.  
  167. This  document  is  a brief  description  of  XLISP-PLUS.  It assumes  some
  168. knowledge of LISP and some understanding of the concepts of object-oriented
  169. programming.
  170.  
  171. You will probably also need a copy of "Common Lisp: The Language" by Guy L.
  172. Steele,  Jr., published by Digital Press to use  as a reference for some of
  173. the Common Lisp functions that are described only briefly in this document.
  174.  
  175. XLISP-PLUS has a number  of compilation options  to to eliminate groups  of
  176. functions and  to tailor itself  to various environments.  Unless otherwise
  177. indicated  this manual  assumes  all options  are  enabled and  the  system
  178. dependent code is as complete as  that provided for the MS/DOS environment.
  179. Assistance  for using or  porting XLISP-PLUS can be  obtained on the USENET
  180. newsgroup  comp.lang.lisp.x,  or by  writing to  Tom  Almy at  the Internet
  181. address toma@sail.labs.tek.com. You can also reach Tom by writing to him at
  182. 17830 SW Shasta Trail, Tualatin, OR 97062, USA.
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190. XLISP 2.1e                   XLISP COMMAND LOOP                      Page 2
  191.  
  192.  
  193.  
  194. XLISP COMMAND LOOP
  195.  
  196. When XLISP is started, it first tries to load the workspace "xlisp.wks", or
  197. an  alternative  file specified  with  the  "-wfilename" option,  from  the
  198. current directory.  If that file doesn't exist, or  the "-w" flag is in the
  199. command  line,  XLISP builds  an initial  workspace,  empty except  for the
  200. built-in functions and symbols.
  201.  
  202. Then, providing  providing no workspace file was loaded,  XLISP attempts to
  203. load  "init.lsp" from the current directory. It  then loads any files named
  204. as parameters on the command line  (after appending ".lsp" to their names).
  205. If  the  "-v" flag  is  in the  command  line, then  the  files are  loaded
  206. verbosely. The option "-tfilename" will open a transcript file of  the name
  207. "filename".
  208.  
  209. XLISP  then issues  the following  prompt (unless  standard input  has been
  210. redirected):
  211.  
  212. >
  213.  
  214. This indicates that XLISP is waiting for an expression to be typed.
  215.  
  216. When a complete  expression has  been entered, XLISP  attempts to  evaluate
  217. that expression. If the expression evaluates successfully, XLISP prints the
  218. result and then returns for another expression.
  219.  
  220. The following  control characters can  be used  while XLISP is  waiting for
  221. input:
  222.  
  223.      Backspace delete last character
  224.      Del       delete last character
  225.      tab       tabs over (treated as space by XLISP reader)
  226.      ctrl-C    goto top level
  227.      ctrl-G    cleanup and return one level
  228.      ctrl-Z    end of file (returns one level or exits program)
  229.      ctrl-P    proceed (continue)
  230.      ctrl-T    print information
  231.  
  232. Under MS-DOS the following  control characters can be typed while  XLISP is
  233. executing (providing standard input  has not been redirected away  from the
  234. console):
  235.  
  236.      ctrl-B    BREAK -- enter break loop
  237.      ctrl-S    Pause until another key is struck
  238.      ctrl-C    go to top level (if lucky: ctrl-B,ctrl-C is safer)
  239.      ctrl-T    print information
  240.  
  241. Under MS-DOS if the global variable *dos-input* is set non-NIL, DOS is used
  242. to read entire input lines. Operation this way is convenient if certain DOS
  243. utilities, such as CED, are  used, or if XLISP is run under  an editor like
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251. XLISP 2.1e                   XLISP COMMAND LOOP                      Page 3
  252.  
  253.  
  254. EPSILON. In  this case, normal command  line editing is available,  but the
  255. control keys will not work (in particular, ctrl-C will cause the program to
  256. exit!). Use the  XLISP functions top-level, clean-up, and  continue instead
  257. of ctrl-C, ctrl-G, and ctrl-P.
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265. XLISP 2.1e                   BREAK COMMAND LOOP                      Page 4
  266.  
  267.  
  268.  
  269. BREAK COMMAND LOOP
  270.  
  271. When  XLISP encounters an error while evaluating an expression, it attempts
  272. to handle the error in the following way:
  273.  
  274. If the symbol  '*breakenable*' is  true, the message  corresponding to  the
  275. error is  printed. If the  error is correctable, the  correction message is
  276. printed.
  277.  
  278. If the symbol  '*tracenable*' is true, a trace back  is printed. The number
  279. of entries  printed depends on the  value of the symbol  '*tracelimit*'. If
  280. this  symbol is set to something other than a number, the entire trace back
  281. stack is printed.
  282.  
  283. XLISP  then enters a read/eval/print loop to  allow the user to examine the
  284. state of  the interpreter in  the context of  the error. This  loop differs
  285. from the normal top-level read/eval/print loop in  that if the user invokes
  286. the function 'continue', XLISP  will continue from a correctable  error. If
  287. the user invokes  the function 'clean-up', XLISP will  abort the break loop
  288. and return to the top level or  the next lower numbered break loop. When in
  289. a break loop, XLISP prefixes the break level to the normal prompt.
  290.  
  291. If the symbol '*breakenable*' is NIL, XLISP looks  for a surrounding errset
  292. function. If one is found, XLISP  examines the value of the print  flag. If
  293. this  flag is true, the error message is printed. In any case, XLISP causes
  294. the errset function call to return NIL.
  295.  
  296. If there is no surrounding errset function,  XLISP prints the error message
  297. and returns to the top level.
  298.  
  299. If XLISP was invoked with the command line argument "-b" then XLISP assumes
  300. it  is running in batch mode.  In batch mode any  uncaught error will cause
  301. XLISP to exit after printing the error message.
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309. XLISP 2.1e                       DATA TYPES                          Page 5
  310.  
  311.  
  312.  
  313. DATA TYPES
  314.  
  315. There are several different data types available to XLISP-PLUS programmers.
  316. Typical implementation limits  are shown for 32 bit word systems. Values in
  317. square brackets apply to 16 bit MS-DOS implementations.
  318.  
  319. All data  nodes are effectively  cons cells consisting of  two pointers and
  320. and one or two bytes of identification flags (9 or 10 bytes per cell). Node
  321. space is managed and garbage  collected by XLISP. Array and  string storage
  322. is either allocated  by the C runtime or managed  and garbaged collected by
  323. XLISP  (compilation option). If C does the allocation, memory fragmentation
  324. can  occur. Fragmentation  can  be  eliminated  by  saving  the  image  and
  325. restarting XLISP-PLUS.
  326.  
  327.  
  328. ˘    NIL
  329.      Unlike  the  original XLISP,  NIL  is a  symbol (although  not  in the
  330.      *obarray*), to allowing setting its properties.
  331. ˘    lists
  332.      Either NIL  or a CDR-linked list of cons cells, terminated by a symbol
  333.      (typically NIL). Circular  lists are allowable, but can cause problems
  334.      with some functions so they must be used with care.
  335. ˘    arrays
  336.      The CDR field  of an array  points to the  dynamically allocated  data
  337.      array,  while  the  CAR contains  the  integer  length  of the  array.
  338.      Elements in the data array are  pointers to other cells [Size  limited
  339.      to about 16360].
  340. ˘    character strings
  341.      Implemented like  arrays,  except string  array  is byte  indexed  and
  342.      contains the actual characters. Note that unlike the underlying C, the
  343.      null character (value 0) is valid. [Size limited to about 65500]
  344. ˘    symbols
  345.      Implemented  as  a  4 element  array.  The  elements  are value  cell,
  346.      function  cell, property  list,  and print  name  (a character  string
  347.      node). Print names are limited to 100 characters. There are also flags
  348.      for constant and  special. Values bound  to special symbols  (declared
  349.      with DEFVAR or DEFPARAMETER) are always dynamically bound, rather than
  350.      being lexically bound.
  351. ˘    fixnums (integers)
  352.      Small integers (> -129 and <256) are statically allocated and are thus
  353.      always EQ integers  of the same value.  The CAR field is used  to hold
  354.      the value, which is a 32 bit signed integer.
  355. ˘    ratios
  356.      The CAR field  is used to hold  the numerator while  the CDR field  is
  357.      used  to hold the denominator. The numerator  is a 32 bit signed value
  358.      while the denominator is a 31 bit positive value.
  359. ˘    characters
  360.      All  characters are statically allocated and are thus EQ characters of
  361.      the  same value. The  CAR field is  used to  hold the value.  In XLISP
  362.      characters are "unsigned" and thus range in value from 0 to 255.
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370. XLISP 2.1e                       DATA TYPES                          Page 6
  371.  
  372.  
  373. ˘    flonums (floating point numbers)
  374.      The CAR and  CDR fields hold  the value, which  is typically a 64  bit
  375.      IEEE floating point number.
  376. ˘    complex numbers
  377.      Part of the math  extension compilation option. Internally implemented
  378.      as an  array of the real and imaginary  parts. The parts can be either
  379.      both  fixnums  or both  flonums. Any  function  which would  return an
  380.      fixnum  complex number  with a  zero imaginary  part returns  just the
  381.      fixnum.
  382. ˘    objects
  383.      Implemented  as an array of instance variable count plus one elements.
  384.      The first element is the object's class, while the remaining arguments
  385.      are the instance variables.
  386. ˘    streams (file)
  387.      The CAR  and CDR fields are used  in a system dependent  way as a file
  388.      pointer.
  389. ˘    streams (unnamed -- string)
  390.      Implemented as a tconc-style list of characters.
  391. ˘    subrs (built-in functions)
  392.      The CAR  field points  to the  actual code to  execute, while  the CDR
  393.      field is an internal pointer to the name of the function.
  394. ˘    fsubrs (special forms)
  395.      Same implementation as subrs.
  396. ˘    closures (user defined functions)
  397.      Implemented as an array of 11 elements:
  398.      1.   name symbol or NIL
  399.      2.   'lambda or 'macro
  400.      3.   list of required arguments
  401.      4.   optional  arguments  as  list  of  (<arg>  <init>  <specified-p>)
  402.           triples.
  403.      5.   &rest argument
  404.      6.   &key  arguments as  list  of (<key>  <arg> <init>  <specified-p>)
  405.           quadruples.
  406.      7.   &aux arguments as list of (<arg> <init>) pairs.
  407.      8.   function body
  408.      9.   value environment (see page 78 for format)
  409.      10.  function environment
  410.      11.  argument list (unprocessed)
  411. ˘    structures
  412.      Implemented as an  array with  first element  being a  pointer to  the
  413.      structure name string, and the  remaining elements being the structure
  414.      elements.
  415. ˘    hash-tables
  416.      Implemented  as a  structure  of varying  length  with no  generalized
  417.      accessing  functions,  but  with   a  special  print  function  (print
  418.      functions not available for standard structures).
  419. ˘    random-states
  420.      Implemented as a structure  with a single element which  is the random
  421.      state  (here  a fixnum,  but  could  change  without  impacting  xlisp
  422.      programs).
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430. XLISP 2.1e                     THE EVALUATOR                         Page 7
  431.  
  432.  
  433.  
  434. THE EVALUATOR
  435.  
  436. The process of evaluation in XLISP:
  437.  
  438. Strings,  characters, numbers  of  any type,  objects, arrays,  structures,
  439. streams, subrs, fsubrs and closures evaluate to themselves.
  440.  
  441. Symbols  act as  variables  and  are  evaluated  by  retrieving  the  value
  442. associated with their current binding.
  443.  
  444. Lists  are evaluated by  examining the first  element of the  list and then
  445. taking one of the following actions:
  446.  
  447.      If it is a symbol, the functional binding of the symbol is retrieved.
  448.  
  449.      If  it is  a  lambda  expression, a  closure  is  constructed for  the
  450.      function described by the lambda expression.
  451.  
  452.      If it is a subr, fsubr or closure, it stands for itself.
  453.  
  454.      Any other value is an error.
  455.  
  456. Then, the value produced by the previous step is examined:
  457.  
  458.      If it is a subr or  closure, the remaining list elements are evaluated
  459.      and the subr or closure is applied to these evaluated expressions.
  460.  
  461.      If  it is  an  fsubr, the  fsubr  is called  with  the remaining  list
  462.      elements as arguments (unevaluated).
  463.  
  464.      If  it is  a macro,  the  macro is  expanded with  the remaining  list
  465.      elements  as  arguments (unevaluated).  The  macro  expansion is  then
  466.      evaluated  in  place  of  the  original  macro  call.  If  the  symbol
  467.      *displace-macros*   is  not   NIL,  then   the  expanded   macro  will
  468.      (destructively) replace the original macro expression. This means that
  469.      the macro  will only be expanded  once, but the original  code will be
  470.      lost.  The displacement will not  take place unless  the macro expands
  471.      into a list. The standard XLISP practice is the macro will be expanded
  472.      each  time  the expression  is evaluated,  which  negates some  of the
  473.      advantages of using macros.
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481. XLISP 2.1e                     HOOK FUNCTIONS                        Page 8
  482.  
  483.  
  484.  
  485. HOOK FUNCTIONS
  486.  
  487. The  evalhook and applyhook facility  are useful for implementing debugging
  488. programs  or just  observing the  operation  of XLISP.  It  is possible  to
  489. control evaluation of forms in any context.
  490.  
  491. If the symbol '*evalhook*' is bound  to a function closure, then every call
  492. of  eval will call  this function. The  function takes two  arguements, the
  493. form to be  evaluated and  execution environment. During  the execution  of
  494. this function, *evalhook* (and *applyhook*) are dynamically bound to NIL to
  495. prevent undesirable recursion.  This "hook" function returns the  result of
  496. the evaluation.
  497.  
  498. If the  symbol '*applyhook*' is  bound to a  function, then every  function
  499. application within an  eval will call this function (note that the function
  500. apply, and others  which do not  use eval, will not  invoke the apply  hook
  501. function). The function takes  two arguments, the function closure  and the
  502. argument list (which is  already evaluated). During execution of  this hook
  503. function,  *applyhook* (and  *evalhook*)  are dynamically  bound to  NIL to
  504. prevent undesired recursion. This function  is to return the result  of the
  505. function application.
  506.  
  507. Note that the hook functions cannot reset *evalhook* or *applyhook* to NIL,
  508. because  upon  exit these  values  will be  reset.  An excape  mechanism is
  509. provided  -- execution of 'top-level',  or any error  that causes return to
  510. the  top level, will unhook  the functions. Applications  should bind these
  511. values either via 'progv', 'evalhook', or 'applyhook'.
  512.  
  513. The functions 'evalhook' and 'applyhook' allowed for controlled application
  514. of  the hook functions. The form supplied  as an argument to 'evalhook', or
  515. the function application  given to 'applyhook', are  not hooked themselves,
  516. but  any subsidiary forms and  applications are. In  addition, by supplying
  517. NIL values for the hook functions, 'evalhook' can be used to execute a form
  518. within a specific environment passed as an argument.
  519.  
  520. An additional hook function exists for the garbage collector. If the symbol
  521. '*gc-hook*'  is bound  to a  function, then  this function is  called after
  522. every garbage collection. The function has  two arguments. The first is the
  523. total number  of nodes,  and the second  is the number  of nodes  free. The
  524. return value is ignored. During the execution of the function, *gc-hook* is
  525. dynamically bound to NIL to prevent undesirable recursion.
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533. XLISP 2.1e                  LEXICAL CONVENTIONS                      Page 9
  534.  
  535.  
  536.  
  537. LEXICAL CONVENTIONS
  538.  
  539. The following conventions must be followed when entering XLISP programs:
  540.  
  541. Comments in  XLISP code begin with  a semi-colon character and  continue to
  542. the end of the line.
  543.  
  544. Except when escape sequences are used, symbol names in XLISP can consist of
  545. any sequence of non-blank printable characters except the terminating macro
  546. characters:
  547.  
  548.      ( ) ' ` , " ;
  549.  
  550. and the escape characters:
  551.  
  552.      \ |
  553.  
  554. In  addition, the  first character  may not  be '#'  (non-terminating macro
  555. character),  nor  may  the symbol  have  identical  syntax  with a  numeric
  556. literal. Uppercase  and lowercase  characters are not  distinguished within
  557. symbol names  because,  by  default, lowercase  characters  are  mapped  to
  558. uppercase on input.
  559.  
  560. Any printing character, including whitespace, may be part of a  symbol name
  561. when  escape  characters  are used.  The  backslash  escapes  the following
  562. character, while multiple characters can be escaped by placing them between
  563. vertical bars. At  all times the  backslash must be  used to escape  either
  564. escape characters.
  565.  
  566. For  semantic reasons,  certain chararacter  sequences should/can  never be
  567. used as  symbols in XLISP. A single period  is used to denote dotted lists.
  568. The symbol  NIL represents an empty list. Symbols starting with a colon are
  569. keywords,  and will always evaluate to themselves. Thus they  should not be
  570. used as regular symbols. The symbol T is also reserved for use as the truth
  571. value.
  572.  
  573. Fixnum (integer)  literals  consist  of  a sequence  of  digits  optionally
  574. beginning  with a sign  ('+' or  '-'). The range  of values  an integer can
  575. represent is  limited by the  size of a  C 'long' on  the machine  on which
  576. XLISP is running. 
  577.  
  578. Ratio  literals  consist  of two  integer  literals  separated  by a  slash
  579. character ('/').  The second  number, the  denominator,  must be  positive.
  580. Ratios  are automatically  reduced to  their cannonical  form; if  they are
  581. integral, then they are reduced to an integer.
  582.  
  583. Flonum (floating point) literals consist of a sequence of digits optionally
  584. beginning with a sign ('+' or '-') and including one or both of an embedded
  585. decimal point or  a trailing exponent. The optional exponent  is denoted by
  586. an  'E' or 'e'  followed by an  optional sign and  one or more  digits. The
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594. XLISP 2.1e                  LEXICAL CONVENTIONS                     Page 10
  595.  
  596.  
  597. range of values  a floating point  number can represent  is limited by  the
  598. size of a C 'double' on most machines on which XLISP is running.
  599.  
  600. Numeric literals cannot have  embedded escape characters. If they  do, they
  601. are treated as symbols. Thus '12\3' is a symbol even though it would appear
  602. to be identical to '123'.
  603.  
  604. Complex literals are constructed using a read-macro of the  format #C(r i),
  605. where  r is the real part  and i is the imaginary  part. The numeric fields
  606. can be any  valid fixnum, ratio, or flonum  literal. If either field  has a
  607. ratio or flonum literal,  then both values are converted to flonums. Fixnum
  608. complex  literals with a zero  imaginary part are  automatically reduced to
  609. fixnums.
  610.  
  611. Character literals are handled via the #\ read-macro construct:
  612.  
  613.      #\<char>       == the ASCII code of the printing character
  614.      #\newline      == ASCII linefeed character
  615.      #\space        == ASCII space character
  616.      #\rubout       == ASCII rubout (DEL)
  617.      #\C-<char>     == ASCII control character
  618.      #\M-<char>     == ASCII character with msb set (Meta character)
  619.      #\M-C-<char>   == ASCII control character with msb set
  620.  
  621.  
  622. Literal  strings are  sequences of  characters surrounded by  double quotes
  623. (the  " read-macro).  Within quoted  strings the  '\' character is  used to
  624. allow non-printable characters to be included. The codes
  625. recognized are:
  626.  
  627.      \\        means the character '\'
  628.      \n        means newline
  629.      \t        means tab
  630.      \r        means return
  631.      \f        means form feed
  632.      \nnn      means the character whose octal code is nnn
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640. XLISP 2.1e                 8 BIT ASCII CHARACTERS                   Page 11
  641.  
  642.  
  643.  
  644. 8 BIT ASCII CHARACTERS
  645.  
  646. When used  in an  IBM PC  environment  (or perhaps  others), XLISP-PLUS  is
  647. compiled by default to allow the full use of the IBM 8 bit  ASCII character
  648. set,  including all characters with  diacritic marks. Note  that using such
  649. characters will make programs non-portable. XLISP-PLUS can be compiled  for
  650. standard 7 bit ASCII if desired for portability.
  651.  
  652. When 8 bit ASCII is enabled, the following system characteristics change:
  653.  
  654. Character codes  128 to 254  are marked  as :constituent in  the readtable.
  655. This means  that  any of  the new  characters (except  for the  nonprinting
  656. character  255)  can be  symbol  constituent.  Alphabetic characters  which
  657. appear in  both cases, such as Ç  and ê, are considered  to be alphabetical
  658. for  purposes of symbol case control, while  characters such as † that have
  659. no coresponding upper case are not considered to be alphabetical.
  660.  
  661. The  reader  is extended  for  the character  data  type to  allow  all the
  662. additional characters  (except  code  255)  to be  entered  literally,  for
  663. instance  "#\Ç". These characters  are also printed  literally, rather than
  664. using the "M-"  construct. Code 255 must  still be entered as,  and will be
  665. printed as, "#\M-Rubout".
  666.  
  667. Likewise  strings do  not  need  and  will not  use  the  backslash  escape
  668. mechanism for codes 128 to 254.
  669.  
  670. The functions alphanumericp,  alpha-char-p, upper-case-p, and  lower-case-p
  671. perform  as  would be  expected on  the  extended characters,  treating the
  672. diacritic characters  as their  unadorned counterparts. As  per the  Common
  673. Lisp definition, both-case-p  will only indicate T for characters available
  674. in both cases.
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682. XLISP 2.1e                       READTABLES                         Page 12
  683.  
  684.  
  685.  
  686. READTABLES
  687.  
  688. The  behaviour of  the reader is  controlled by  a data  structure called a
  689. "readtable". The reader uses  the symbol *readtable* to locate  the current
  690. readtable. This table controls the interpretation of input characters -- if
  691. it  is  changed then  the section  LEXICAL CONVENTIONS  may not  apply. The
  692. readtable is  an array with 256 entries, one for each of the extended ASCII
  693. character codes. Each entry contains one of the following values, with  the
  694. initial entries assigned to the values indicated:
  695.  
  696.      :white-space        A whitespace character - tab, cr, lf, ff, space
  697.      (:tmacro . fun)     terminating readmacro - ( ) " , ; ' `
  698.      (:nmacro . fun)     non-terminating readmacro - #
  699.      :sescape            Single escape character - \
  700.      :mescape            Multiple escape character - |
  701.      :constituent        Indicating  a  symbol  constituent  (all  printing
  702.                          characters not listed above)
  703.      NIL                 Indicating an invalid character (everything else)
  704.  
  705. In the case of :TMACRO and :NMACRO, the "fun" component is a function. This
  706. can either be  a built-in  readmacro function or  a lambda expression.  The
  707. function takes two parameters. The first is the input stream and the second
  708. is the character that caused the invocation of the readmacro. The readmacro
  709. function should return NIL to indicate that the character should be treated
  710. as  white space or a  value consed with NIL to  indicate that the readmacro
  711. should be  treated as an occurance  of the specified value.  Of course, the
  712. readmacro code is free to read additional characters from the input stream.
  713. A  :nmacro is  a symbol  constituent  except as  the first  character of  a
  714. symbol.
  715.  
  716. As an  example, the following read  macro allows the square  brackets to be
  717. used as a more visibly appealing alternative to the SEND function:
  718.  
  719. (setf (aref *readtable* (char-int #\[)) ; #\[ table entry
  720.       (cons :tmacro
  721.             (lambda (f c &aux ex) ; second arg is not used
  722.                     (do ()
  723.                         ((eq (peek-char t f) #\]))
  724.                         (setf ex (append ex (list (read f)))))
  725.                     (read-char f) ; toss the trailing #\]
  726.                     (cons (cons 'send ex) NIL))))
  727.  
  728. (setf (aref *readtable* (char-int #\]))
  729.       (cons :tmacro
  730.             (lambda (f c)
  731.                     (error "misplaced right bracket"))))
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739. XLISP 2.1e                       READTABLES                         Page 13
  740.  
  741.  
  742. XLISP defines several useful read macros:
  743.  
  744.      '<expr>             == (quote <expr>)
  745.      `<expr>             == (backquote <expr>)
  746.      ,<expr>             == (comma <expr>)
  747.      ,@<expr>            == (comma-at <expr>)
  748.      #'<expr>            == (function <expr>)
  749.      #(<expr>...)        == an array of the specified expressions
  750.      #S(<structtype> [<slotname> <value>]...)
  751.                          == structure of specified type and initial values
  752.      #.<expr>            == result of evaluating <expr>
  753.      #x<hdigits>         == a hexadecimal number (0-9,A-F)
  754.      #o<odigits>         == an octal number (0-7)
  755.      #b<bdigits>         == a binary number (0-1)
  756.      #|  |#              == a comment
  757.      #:<symbol>          == an uninterned symbol
  758.      #C(r i)             == a complex number
  759.      #+<expr>            == conditional on feature expression true
  760.      #-<expr>            == conditional on feature expression false
  761.  
  762. A feature expression is either  a symbol or a list where the  first element
  763. is AND,  OR, or NOT and  any remaining elements (NOT  requires exactly one)
  764. are  feature expressions.  A symbol  is  true if  it is  a member  (by test
  765. function  EQ) of the list  in global variable  *FEATURES*. Init.lsp defines
  766. one  initial  feature,  :XLISP.  Utility  files  supplied  with  XLISP-PLUS
  767. generally add new features which are EQ to the keyword made from their file
  768. names.
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776. XLISP 2.1e                  SYMBOL CASE CONTROL                     Page 14
  777.  
  778.  
  779.  
  780. SYMBOL CASE CONTROL
  781.  
  782. XLISP-PLUS  uses  two  variables,  *READTABLE-CASE*  and   *PRINT-CASE*  to
  783. deturmine  case   conversion  during  reading  and   printing  of  symbols.
  784. *READTABLE-CASE*  can  have  the  values  :UPCASE  :DOWNCASE  :PRESERVE  or
  785. :INVERT,  while *PRINT-CASE* can have  the values :UPCASE  or :DOWNCASE. By
  786. default, or when other values have been specified, both are :UPCASE.
  787.  
  788. When *READTABLE-CASE*  is :UPCASE,  all unescaped lowercase  characters are
  789. converted  to  uppercase when  read. When  it  is :DOWNCASE,  all unescaped
  790. uppercase  characters are  converted to  lowercase. This  mode is  not very
  791. useful because the predefined symbols  are all uppercase and would need  to
  792. be  escaped to read them. When *READTABLE-CASE* is :PRESERVE, no conversion
  793. takes  place. This allows case sensitive input with predefined functions in
  794. uppercase. The final  choice, :INVERT, will invert  the case of  any symbol
  795. that is not mixed case. This provides case sensitive input while making the
  796. predefined functions and variables appear to be in lowercase.
  797.  
  798. The  printing of symbols involves the settings of both *READTABLE-CASE* and
  799. *PRINT-CASE*. When  *READTABLE-CASE* is  :UPCASE, lowercase  characters are
  800. escaped (unless PRINC is used), and uppercase characters are printed in the
  801. case  specified  by  *PRINT-CASE*.  When   *READTABLE-CASE*  is  :DOWNCASE,
  802. uppercase  characters are escaped (unless PRINC is used), and lowercase are
  803. printed   in   the   case   specified  by   *PRINT-CASE*.   The   remaining
  804. *READTABLE-CASE*  modes ignore  *PRINT-CASE* and  do not  escape alphabetic
  805. characters. :PRESERVE  never changes the  case of characters  while :INVERT
  806. inverts the case of any non mixed-case symbols.
  807.  
  808. There are four major useful combinations of these modes:
  809.  
  810. A:  *READTABLE-CASE* :UPCASE  *PRINT-CASE* :UPCASE
  811.  
  812. "Traditional" mode. Case  insensitive input; must  escape to put  lowercase
  813. characters in symbol names. Symbols print exactly as  they are stored, with
  814. lowercase characters escaped when PRIN1 is used.
  815.  
  816. B:  *READTABLE-CASE* :UPCASE  *PRINT-CASE* :DOWNCASE
  817.  
  818. "Eyesaver"  mode.  Case insensitive  input;  must escape  to  put lowercase
  819. characters  in symbol  name.  Symbols print  entirely  in lowercase  except
  820. symbols escaped when lowercase characters present with PRIN1.
  821.  
  822. C:  *READTABLE-CASE* :PRESERVE
  823.  
  824. "Oldfashioned  case  sensitive"  mode.  Case  sensitive  input.  Predefined
  825. symbols must be typed in uppercase. No alpha quoting needed.  Symbols print
  826. exactly as stored.
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834. XLISP 2.1e                  SYMBOL CASE CONTROL                     Page 15
  835.  
  836.  
  837. D:  *READTABLE-CASE* :INVERT
  838.  
  839. "Modern case sensitive" mode. Case sensitive input. Predefined symbols must
  840. be  typed in lowercase. Alpha quoting should be avoided. Predefined symbols
  841. print in lower case, other symbols print as they were entered.
  842.  
  843. As far as compatibility between these modes  are concerned, data printed in
  844. mode A  can be read in A, B, or C. Data printed in mode B can be read in A,
  845. B, and D. Data printed in mode C can be read in mode C, and if no lowercase
  846. symbols in  modes A and B  as well. Data printed  in mode D can  be read in
  847. mode D, and if no (internally) lowercase symbols in  modes A and B as well.
  848. In addition, symbols containing characters requiring quoting are compatible
  849. among all modes.
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857. XLISP 2.1e                      LAMBDA LISTS                        Page 16
  858.  
  859.  
  860.  
  861. LAMBDA LISTS
  862.  
  863. There  are several  forms in  XLISP that  require that  a "lambda  list" be
  864. specified. A  lambda list is  a definition of  the arguments accepted  by a
  865. function. There are four different types of arguments.
  866.  
  867. The  lambda list starts with required arguments. Required arguments must be
  868. specified in every call to the function.
  869.  
  870. The required  arguments are followed  by the &optional  arguments. Optional
  871. arguments  may  be  provided  or  omitted  in  a  call.  An  initialization
  872. expression  may be specified  to provide a  default value  for an &optional
  873. argument if it  is omitted from a call. If  no initialization expression is
  874. specified, an omitted argument  is initialized to NIL. It  is also possible
  875. to  provide  the name  of  a  'supplied-p' variable  that  can  be used  to
  876. determine  if  a  call  provided  a  value  for  the  argument  or  if  the
  877. initialization expression  was used. If specified,  the supplied-p variable
  878. will be  bound to T  if a value  was specified in the  call and NIL  if the
  879. default value was used.
  880.  
  881. The  &optional  arguments are  followed by  the  &rest argument.  The &rest
  882. argument  gets bound  to  the  remainder of  the  argument  list after  the
  883. required and &optional arguments have been removed.
  884.  
  885. The  &rest argument  is  followed by  the  &key arguments.  When  a keyword
  886. argument is passed to a function, a  pair of values appears in the argument
  887. list. The first expression in the pair should evaluate to  a keyword symbol
  888. (a symbol that  begins with a ':').  The value of the second  expression is
  889. the value of the keyword argument. Like &optional arguments, &key arguments
  890. can have initialization expressions  and supplied-p variables. In addition,
  891. it is possible to specify the keyword to be used in a function call.  If no
  892. keyword is specified, the keyword obtained by adding a ':' to the beginning
  893. of  the keyword  argument symbol is  used. In  other words,  if the keyword
  894. argument symbol is 'foo', the  keyword will be ':foo'. Extra keywords  will
  895. signal  an error  unless &allow-other-keys  is present,  in which  case the
  896. extra keywords are  ignored. In  XLISP, the  &allow-other-keys argument  is
  897. ignored, and extra keywords are ignored.
  898.  
  899. The &key arguments  are followed  by the  &aux variables.  These are  local
  900. variables that are bound during the  evaluation of the function body. It is
  901. possible to have initialization expressions for the &aux variables.
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909. XLISP 2.1e                      LAMBDA LISTS                        Page 17
  910.  
  911.  
  912. Here is the complete syntax for lambda lists:
  913.  
  914.      (<rarg>...
  915.       [&optional [<oarg> | (<oarg> [<init> [<svar>]])]...]
  916.       [&rest <rarg>]
  917.       [&key
  918.        [<karg>  |  ([<karg>  |  (<key>  <karg>)]  [<init>  [<svar>]])]  ...
  919.      [&allow-other-keys]]
  920.       [&aux [<aux> | (<aux> [<init>])]...])
  921.  
  922.     where:
  923.  
  924.      <rarg>    is a required argument symbol
  925.      <oarg>    is an &optional argument symbol
  926.      <rarg>    is the &rest argument symbol
  927.      <karg>    is a &key argument symbol
  928.      <key>     is a keyword symbol (starts with ':')
  929.      <aux>     is an auxiliary variable symbol
  930.      <init>    is an initialization expression
  931.      <svar>    is a supplied-p variable symbol
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939. XLISP 2.1e                        OBJECTS                           Page 18
  940.  
  941.  
  942.  
  943. OBJECTS
  944.  
  945. Definitions:
  946.  
  947. ˘    selector - a symbol used to select an appropriate method
  948. ˘    message - a selector and a list of actual arguments
  949. ˘    method - the code that implements a message
  950.  
  951. Since XLISP  was created to provide  a simple basis  for experimenting with
  952. object-oriented programming,  one of the  primitive data types  included is
  953. 'object'. In  XLISP, an object  consists of  a data structure  containing a
  954. pointer  to the object's class as well as an array containing the values of
  955. the object's instance variables.
  956.  
  957. Officially,  there is no way to see inside an object (look at the values of
  958. its instance variables).  The only way to communicate with  an object is by
  959. sending it a message.
  960.  
  961. You  can send  a  message to  an  object using  the  'send' function.  This
  962. function takes  the object as its  first argument, the  message selector as
  963. its  second argument (which must be a  symbol) and the message arguments as
  964. its remaining arguments.
  965.  
  966. The  'send' function  determines  the class  of  the receiving  object  and
  967. attempts to find a method corresponding  to the message selector in the set
  968. of messages  defined for  that class. If  the message is  not found  in the
  969. object's class  and the class  has a  super-class, the search  continues by
  970. looking at the messages defined for the super-class. This process continues
  971. from one super-class to the  next until a method for the  message is found.
  972. If no method is found, an error occurs.
  973.  
  974. To perform a  method lookup  starting with the  method's superclass  rather
  975. than  the  object's class,  use the  function  'send-super'. This  allows a
  976. subclass to  invoke a standard  method in its  parent class even  though it
  977. overrides that method with its own specialized version.
  978.  
  979. When a  method is found,  the evaluator binds  the receiving object  to the
  980. symbol 'self' and evaluates the method  using the remaining elements of the
  981. original  list as  arguments  to the  method.  These arguments  are  always
  982. evaluated prior to being bound to their corresponding formal arguments. The
  983. result of evaluating the method becomes the result of the expression.
  984.  
  985. Two  objects, both classes, are  predefined: Object and  Class. Both Object
  986. and Class  are of class  Class. The  superclass of Class  is Object,  while
  987. Object has no superclass. Typical use is to create new  classes (by sending
  988. :new  to Class) to represent application objects. Objects of these classes,
  989. created by  sending :new to  the appropriate new  class, are subclasses  of
  990. Object.  The Object method  :show can be  used to view  the contents of any
  991. object.
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999. XLISP 2.1e                        OBJECTS                           Page 19
  1000.  
  1001.  
  1002.  
  1003. THE 'Object' CLASS
  1004.  
  1005. Object  THE TOP OF THE CLASS HEIRARCHY
  1006.  
  1007. Messages:
  1008.  
  1009.      :show                              SHOW AN OBJECT'S INSTANCE VARIABLES
  1010.                returns   the object
  1011.  
  1012.      :class                                   RETURN THE CLASS OF AN OBJECT
  1013.                returns   the class of the object
  1014.  
  1015.      :prin1 [<stream>]                                     PRINT THE OBJECT
  1016.                <stream>  default,  or  NIL,  is  *standard-output*,   T  is
  1017.                          *terminal-io*
  1018.                returns   the object
  1019.  
  1020.      :isnew                       THE DEFAULT OBJECT INITIALIZATION ROUTINE
  1021.                returns   the object
  1022.  
  1023.      :superclass                           GET THE SUPERCLASS OF THE OBJECT
  1024.                returns   NIL
  1025.                (Defined in classes.lsp, see :superclass below)
  1026.  
  1027.      :ismemberof <class>                                   CLASS MEMBERSHIP
  1028.                <class>   class name
  1029.                returns   T if object member of class, else NIL
  1030.                (defined in classes.lsp)
  1031.  
  1032.      :iskindof <class>                                     CLASS MEMBERSHIP
  1033.                <class>   class name
  1034.                returns   T if object member of class or  subclass of class,
  1035.                          else NIL
  1036.                (defined in classes.lsp)
  1037.  
  1038.      :respondsto <sel>                                   SELECTOR KNOWLEDGE
  1039.                <sel>     message selector
  1040.                returns   T if  object  responds to  message selector,  else
  1041.                          NIL.
  1042.                (defined in classes.lsp)
  1043.  
  1044.      :storeon                                           READ REPRESENTATION
  1045.                returns   a list, that when  executed will create a copy  of
  1046.                          the  object.  Only  works for  members  of classes
  1047.                          created with defclass.
  1048.                (defined in classes.lsp)
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056. XLISP 2.1e                        OBJECTS                           Page 20
  1057.  
  1058.  
  1059.  
  1060. THE 'Class' CLASS
  1061.  
  1062. Class   THE CLASS OF ALL OBJECT CLASSES (including itself)
  1063.  
  1064. Messages:
  1065.  
  1066.      :new                                  CREATE A NEW INSTANCE OF A CLASS
  1067.                returns   the new class object
  1068.  
  1069.      :isnew <ivars> [<cvars> [<super>]]              INITIALIZE A NEW CLASS
  1070.                <ivars>   the list of instance variable symbol
  1071.                <cvars>   the list of class variable symbols
  1072.                <super>   the superclass (default is Object)
  1073.                returns   the new class object
  1074.  
  1075.      :answer <msg> <fargs> <code>                  ADD A MESSAGE TO A CLASS
  1076.                <msg>     the message symbol
  1077.                <fargs>   the formal argument list (lambda list)
  1078.                <code>    a list of executable expressions
  1079.                returns   the object
  1080.  
  1081.      :superclass                           GET THE SUPERCLASS OF THE OBJECT
  1082.                returns   the superclass (of the class)
  1083.                (defined in classes.lsp)
  1084.  
  1085.      :messages                        GET THE LIST OF MESSAGES OF THE CLASS
  1086.                returns   association list of message selectors and closures
  1087.                          for messages.
  1088.                (defined in classes.lsp)
  1089.  
  1090.      :storeon                                           READ REPRESENTATION
  1091.                returns   a  list, that  when  executed  will re-create  the
  1092.                          class and its methods.
  1093.                (defined in classes.lsp)
  1094.  
  1095. When  a new instance of a class is created by sending the message ':new' to
  1096. an existing  class, the message  ':isnew' followed  by whatever  parameters
  1097. were passed  to the ':new'  message is  sent to the  newly created  object.
  1098. Therefore,  when a new class is created  by sending ':new' to class 'Class'
  1099. the message ':isnew' is sent to Class automatically. To create a new class,
  1100. a function of the following format is used:
  1101.     (setq <newclassname> (send Class :new <ivars> [<cvars> [<super>]]))
  1102.  
  1103. When  a new  class  is  created, an  optional  parameter  may be  specified
  1104. indicating the superclass of the  new class. If this parameter is  omitted,
  1105. the new class will be a subclass of 'Object'. A class inherits all instance
  1106. variables,  and methods  from its  super-class. Only  class variables  of a
  1107. method's class are accessable.
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115. XLISP 2.1e                        OBJECTS                           Page 21
  1116.  
  1117.  
  1118. INSTANCE VARIABLES OF CLASS 'CLASS':
  1119.  
  1120.      MESSAGES   -  An  association  list  of  message  names  and  closures
  1121.                implementing the messages.
  1122.  
  1123.      IVARS - List of names of instance variables.
  1124.  
  1125.      CVARS - List of names of class variables.
  1126.  
  1127.      CVAL - Array of class variable values.
  1128.  
  1129.      SUPERCLASS -  The superclass  of this  class or  NIL if  no superclass
  1130.                (only for class OBJECT).
  1131.  
  1132.      IVARCNT - instance variables in this class (length of IVARS)
  1133.  
  1134.      IVARTOTAL  -  total  instance   variables  for  this  class  and   all
  1135.                superclasses of this class.
  1136.  
  1137.      PNAME - printname string for this class.
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145. XLISP 2.1e                        SYMBOLS                           Page 22
  1146.  
  1147.  
  1148.  
  1149. SYMBOLS
  1150.  
  1151. All  values are initially NIL  unless otherwise specified.  All are special
  1152. variables unless indicated to be constants.
  1153.  
  1154. ˘    NIL - represents  empty list and  the boolean  value for "false".  The
  1155.      value of  NIL is NIL, and  cannot be changed (it is  a constant). (car
  1156.      NIL) and (cdr NIL) are also defined to be NIL.
  1157. ˘    t - boolean value "true" is constant with value t.
  1158. ˘    self -  within a  method context,  the current  object (see page  18),
  1159.      otherwise initially unbound.
  1160. ˘    object - constant, value is the class 'Object.'
  1161. ˘    class - constant, value is the class 'Class'.
  1162. ˘    internal-time-units-per-second  - integer constant  to divide returned
  1163.      times by to get time in seconds.
  1164. ˘    pi - floating  point aproximation  of pi (constant  defined when  math
  1165.      extension is compiled).
  1166. ˘    *obarray* -  the object hash  table. Length of array  is a compilation
  1167.      option. Objects are hashed using the hash function and are placed on a
  1168.      list in the appropriate array slot.
  1169. ˘    *terminal-io* - stream bound to keyboard and display. Do not alter.
  1170. ˘    *standard-input*  - the  standard  input stream,  initially stdin.  If
  1171.      stdin is not  redirected on  the command line,  then *terminal-io*  is
  1172.      used so that all interactive i/o uses the same stream.
  1173. ˘    *standard-output* -  the standard output stream,  initially stdout. If
  1174.      stdout is not  redirected on  the command line  then *terminal-io*  is
  1175.      used so that all interactive i/o uses the same stream.
  1176. ˘    *error-output* - the error output stream (used by all error messages),
  1177.      initially same as *terminal-io*.
  1178. ˘    *trace-output* - the trace output stream (used by the trace function),
  1179.      initially same as *terminal-io*.
  1180. ˘    *debug-io*   -  the  break   loop  i/o   stream,  initially   same  as
  1181.      *terminal-io*. System messages  (other than error messages) also print
  1182.      out on this stream.
  1183. ˘    *breakenable* -  flag controlling entering  break loop on  errors (see
  1184.      page 4)
  1185. ˘    *tracelist* -  list of names  of functions to  trace, as set  by trace
  1186.      function.
  1187. ˘    *tracenable* - enable trace back printout on errors (see page 4).
  1188. ˘    *tracelimit*  - number of levels  of trace back  information (see page
  1189.      4).
  1190. ˘    *evalhook* - user substitute  for the evaluator function (see  page 8,
  1191.      and evalhook and applyhook functions).
  1192. ˘    *applyhook* -  user substitute for  function application (see  page 8,
  1193.      and evalhook and applyhook functions).
  1194. ˘    *readtable* - the current readtable (see page 12).
  1195. ˘    *unbound* - indicator for unbound symbols. A constant. Do not use this
  1196.      symbol since accessing  any variable to which this has been bound will
  1197.      cause an unbound symbol error message.
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205. XLISP 2.1e                        SYMBOLS                           Page 23
  1206.  
  1207.  
  1208. ˘    *gc-flag*  - controls  the printing  of gc  messages. When  non-NIL, a
  1209.      message  is printed  after  each garbage  collection giving  the total
  1210.      number of nodes and the number of nodes free.
  1211. ˘    *gc-hook* - function to call after garbage collection (see page 8).
  1212. ˘    *integer-format* - format for  printing integers (when not bound  to a
  1213.      string, defaults to "%d" or "%ld" depending on implementation)
  1214. ˘    *ratio-format*  -  format for  printing ratios  (when  not bound  to a
  1215.      string, defaults to "%d/%d" or "%ld/%ld" depending on implementation)
  1216. ˘    *float-format*  -  format for  printing floats  (when  not bound  to a
  1217.      string, defaults to "%g")
  1218. ˘    *readtable-case*  - symbol  read  and output  case.  See page  14  for
  1219.      details
  1220. ˘    *print-case*  -  symbol output  case when  printing.  See page  14 for
  1221.      details
  1222. ˘    *print-level*  - When bound to a number, list levels beyond this value
  1223.      are printed as '#'. Used by all printing functions. Good precaution to
  1224.      avoid getting caught in circular lists.
  1225. ˘    *print-length* - When bound to a number,  lists longer than this value
  1226.      are  printed as '...'. Used by all printing functions. Good precaution
  1227.      to avoid getting caught in circular lists.
  1228. ˘    *dos-input* - When not NIL, uses dos line input function for read (see
  1229.      page 2).
  1230. ˘    *displace-macros*  -  When  not  NIL, macros  are  replaced  by  their
  1231.      expansions when exectuted (see page 7).
  1232. ˘    *random-state* - the default random-state used by the random function.
  1233. ˘    *features*  - list of features, initially (:xlisp), used for #+ and #-
  1234.      reader macros.
  1235.  
  1236. There  are several  symbols  maintained by  the  read/eval/print loop.  The
  1237. symbols  '+', '++',  and '+++'  are bound  to the  most recent  three input
  1238. expressions.  The symbols '*', '**' and '***'  are bound to the most recent
  1239. three results.  The symbol '-' is  bound to the  expression currently being
  1240. evaluated. It becomes the value of '+' at the end of the evaluation.
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248. XLISP 2.1e                  EVALUATION FUNCTIONS                    Page 24
  1249.  
  1250.  
  1251.  
  1252. EVALUATION FUNCTIONS
  1253.  
  1254. (eval <expr>)                                  EVALUATE AN XLISP EXPRESSION
  1255.      <expr>    the expression to be evaluated
  1256.      returns   the result of evaluating the expression
  1257.  
  1258. (apply <fun> <arg>...<args>)        APPLY A FUNCTION TO A LIST OF ARGUMENTS
  1259.      <fun>     the function to apply (or function symbol). May not be macro
  1260.                or fsubr.
  1261.      <arg>     initial arguments, which are CONSed to...
  1262.      <args>    the argument list
  1263.      returns   the result of applying the function to the arguments
  1264.  
  1265. (funcall <fun> <arg>...)                     CALL A FUNCTION WITH ARGUMENTS
  1266.      <fun>     the  function to call (or function symbol). May not be macro
  1267.                or fsubr.
  1268.      <arg>     arguments to pass to the function
  1269.      returns   the result of calling the function with the arguments
  1270.  
  1271. (quote <expr>)                             RETURN AN EXPRESSION UNEVALUATED
  1272.      fsubr
  1273.      <expr>    the expression to be quoted (quoted)
  1274.      returns   <expr> unevaluated
  1275.  
  1276. (function <expr>)                         GET THE FUNCTIONAL INTERPRETATION
  1277.      fsubr
  1278.      <expr>    the symbol or lambda expression (quoted)
  1279.      returns   the functional interpretation
  1280.  
  1281. (identity <expr>)                                     RETURN THE EXPRESSION
  1282.      New function. In common.lsp
  1283.      <expr>    the expression
  1284.      returns   the expression
  1285.  
  1286. (backquote <expr>)                                       FILL IN A TEMPLATE
  1287.      fsubr. Note: an improved backquote facility, which works properly when
  1288.      nested, is available by loading the file backquot.lsp.
  1289.      <expr>    the template (quoted)
  1290.      returns   a  copy of the template  with comma and comma-at expressions
  1291.                expanded.
  1292.  
  1293. (comma <expr>)                                             COMMA EXPRESSION
  1294.      (Never  executed)   As  the  object  of  a  backquote  expansion,  the
  1295.      expression is evaluated and becomes an object in the enclosing list.
  1296.  
  1297. (comma-at <expr>)                                       COMMA-AT EXPRESSION
  1298.      (Never   executed)  As  the  object  of  a  backquote  expansion,  the
  1299.      expression  is evaluated  (and must  evaluate to  a list) and  is then
  1300.      spliced into the enclosing list.
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308. XLISP 2.1e                  EVALUATION FUNCTIONS                    Page 25
  1309.  
  1310.  
  1311. (lambda <args> <expr>...)                           MAKE A FUNCTION CLOSURE
  1312.      fsubr
  1313.      <args>    formal argument list (lambda list) (quoted)
  1314.      <expr>    expressions of the function body (quoted)
  1315.      returns   the function closure
  1316.  
  1317. (get-lambda-expression <closure>)                 GET THE LAMBDA EXPRESSION
  1318.      <closure> the closure
  1319.      returns   the original lambda expression
  1320.  
  1321. (macroexpand <form>)                         RECURSIVELY EXPAND MACRO CALLS
  1322.      <form>    the form to expand
  1323.      returns   the macro expansion
  1324.  
  1325. (macroexpand-1 <form>)                                  EXPAND A MACRO CALL
  1326.      <form>    the macro call form
  1327.      returns   the macro expansion
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335. XLISP 2.1e                    SYMBOL FUNCTIONS                      Page 26
  1336.  
  1337.  
  1338.  
  1339. SYMBOL FUNCTIONS
  1340.  
  1341. (set <sym> <expr>)                         SET THE GLOBAL VALUE OF A SYMBOL
  1342.      <sym>     the symbol being set
  1343.      <expr>    the new value
  1344.      returns   the new value
  1345.  
  1346. (setq [<sym> <expr>]...)                          SET THE VALUE OF A SYMBOL
  1347.      fsubr
  1348.      <sym>     the symbol being set (quoted)
  1349.      <expr>    the new value
  1350.      returns   the new value
  1351.  
  1352. (psetq [<sym> <expr>]...)                          PARALLEL VERSION OF SETQ
  1353.      fsubr. All  expressions are evaluated before  any assignments are
  1354.      made.
  1355.      <sym>     the symbol being set (quoted)
  1356.      <expr>    the new value
  1357.      returns   the new value
  1358.  
  1359. (setf [<place> <expr>]...)                         SET THE VALUE OF A FIELD
  1360.      fsubr
  1361.      <place> the field specifier (if a macro it is expanded,  then the form
  1362.              arguments are evaluated):
  1363.              <sym>                 set value of a symbol
  1364.              (car <expr>)          set car of a cons node
  1365.              (cdr <expr>)          set cdr of a cons node
  1366.              (nth <n> <expr>)      set nth car of a list
  1367.              (aref <expr> <n>)     set nth element of an array or string
  1368.              (elt <expr> <n>)      set nth element of a sequence
  1369.              (get <sym> <prop>)    set value of a property
  1370.              (symbol-value <sym>)  set global value of a symbol
  1371.              (symbol-function <sym>)         set  functional   value  of  a
  1372.                                              symbol
  1373.              (symbol-plist <sym>)  set property list of a symbol
  1374.              (gethash <key> <tbl> <def>)     add  or   replace  hash  table
  1375.              entry. <def> is ignored
  1376.              (send <obj> :<ivar>)  (When  classes.lsp  used), set  instance
  1377.                                    variable of object.
  1378.              (<sym>-<element> <struct>)      set  the element  of structure
  1379.                                              struct, type sym.
  1380.              (<fieldsym> <args>)   the function stored  in property  *setf*
  1381.                                    in  symbol  <fieldsym>  is   applied  to
  1382.                                    (<args> <expr>). As an  alternative, the
  1383.                                    function     stored     in      property
  1384.                                    *setf-lambda*    is  applied,  then  the
  1385.                                    result is evaled in the current context.
  1386.      <value> the new value
  1387.      returns the new value
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395. XLISP 2.1e                    SYMBOL FUNCTIONS                      Page 27
  1396.  
  1397.  
  1398. (defsetf <sym> <fcn>)                         DEFINE A SETF FIELD SPECIFIER
  1399. (defsetf <sym> <fargs> (<value>) <expr>...)
  1400.      Defined  as macro  in common.lsp.  Convenient, Common  Lisp compatible
  1401.      alternative to setting *setf* or *setf-lambda* property directly.
  1402.      <sym>     field specifier symbol (quoted)
  1403.      <fcn>     function  to  use  (quoted  symbol)  which  takes  the  same
  1404.                arguments as the field specifier plus an additional argument
  1405.                for the value. The value must be returned.
  1406.      <fargs>   formal argument list of unevaluated  arguments (lambda list)
  1407.                (quoted)
  1408.      <value>   symbol bound to value to store (quoted).
  1409.      <expr>    The  last expression must  an expression to  evaluate in the
  1410.                setf  context.In this  respect, defsetf  works like  a macro
  1411.                definition.
  1412.      returns   the field specifier symbol
  1413.  
  1414. (push  <expr> <place>)                                      CONS TO A FIELD
  1415.      Defined as  macro in common.lsp.  Only evaluates place  form arguments
  1416.      one time. It is recommended that *displace-macros* be non-NIL for best
  1417.      performance.
  1418.      <place>   field specifier being modified (see setf)
  1419.      <expr>    value to cons to field
  1420.      returns   the new value which is (CONS <expr> <place>)
  1421.  
  1422. (pushnew <expr> <place> &key :test :test-not :key)      CONS NEW TO A FIELD
  1423.      Defined as  macro in common.lsp.  Only evaluates place  form arguments
  1424.      one time. It is recommended that *displace-macros* be non-NIL for best
  1425.      performance.
  1426.      <place>   field specifier being modified (see setf)
  1427.      <expr>    value to cons to field, if not already MEMBER of field
  1428.      :test     the test function (defaults to eql)
  1429.      :test-not the test function (sense inverted)
  1430.      :key      function to  apply to test function  list argument (defaults
  1431.                to identity)
  1432.      returns   the new value which is (CONS <expr> <place>) or <place>
  1433.  
  1434. (pop <place>)                               REMOVE FIRST ELEMENT OF A FIELD
  1435.      Defined as  macro in common.lsp.  Only evaluates place  form arguments
  1436.      one time. It is recommended that *displace-macros* be non-NIL for best
  1437.      performance.
  1438.      <place>   the field being modified (see setf)
  1439.      returns   (CAR <place>), field changed to (CDR <place>)
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447. XLISP 2.1e                    SYMBOL FUNCTIONS                      Page 28
  1448.  
  1449.  
  1450. (incf <place> [<value>])                                  INCREMENT A FIELD
  1451. (decf <place> [<value>])                                  DECREMENT A FIELD
  1452.      Defined  as macro in  common.lsp. Only evaluates  place form arguments
  1453.      one time. It is recommended that *displace-macros* be non-NIL for best
  1454.      performance.
  1455.      <place>   field specifier being modified (see setf)
  1456.      <value>   Numeric value (default 1)
  1457.      returns   the new value  which is  (+ <place> <value>)  or (-  <place>
  1458.                <value>)
  1459.  
  1460. (defun <sym> <fargs> <expr>...)                           DEFINE A FUNCTION
  1461. (defmacro <sym> <fargs> <expr>...)                           DEFINE A MACRO
  1462.      fsubr
  1463.      <sym>     symbol being defined (quoted)
  1464.      <fargs>   formal argument list (lambda list) (quoted)
  1465.      <expr>    expressions constituting the body of the function (quoted)
  1466.      returns   the function symbol
  1467.  
  1468. (gensym [<tag>])                                          GENERATE A SYMBOL
  1469.      <tag>     string or number
  1470.      returns   the new symbol, uninterned
  1471.  
  1472. (intern <pname>)                                    MAKE AN INTERNED SYMBOL
  1473.      <pname>   the symbol's print name string
  1474.      returns   the new symbol
  1475.  
  1476. (make-symbol <pname>)                             MAKE AN UNINTERNED SYMBOL
  1477.      <pname>   the symbol's print name string
  1478.      returns   the new symbol
  1479.  
  1480. (symbol-name <sym>)                          GET THE PRINT NAME OF A SYMBOL
  1481.      <sym>     the symbol
  1482.      returns   the symbol's print name
  1483.  
  1484. (symbol-value <sym>)                              GET THE VALUE OF A SYMBOL
  1485.      <sym>     the symbol
  1486.      returns   the symbol's value
  1487.  
  1488. (symbol-function <sym>)                GET THE FUNCTIONAL VALUE OF A SYMBOL
  1489.      <sym>     the symbol
  1490.      returns   the symbol's functional value
  1491.  
  1492. (symbol-plist <sym>)                      GET THE PROPERTY LIST OF A SYMBOL
  1493.      <sym>     the symbol
  1494.      returns   the symbol's property list
  1495.  
  1496. (hash <expr> <n>)                                    COMPUTE THE HASH INDEX
  1497.      <expr>    the object to hash
  1498.      <n>       the table size (positive integer)
  1499.      returns   the hash index (integer 0 to n-1)
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507. XLISP 2.1e                    SYMBOL FUNCTIONS                      Page 29
  1508.  
  1509.  
  1510. (makunbound <sym>)                           MAKE A SYMBOL VALUE BE UNBOUND
  1511.      You cannot unbind constants.
  1512.      <sym>     the symbol
  1513.      returns   the symbol
  1514.  
  1515. (fmakunbound <sym>)                       MAKE A SYMBOL FUNCTION BE UNBOUND
  1516.      Defined in init.lsp
  1517.      <sym>     the symbol
  1518.      returns   the symbol
  1519.  
  1520. (unintern <sym>)                                          UNINTERN A SYMBOL
  1521.      Defined in common.lsp
  1522.      <sym>     the symbol
  1523.      returns   t if successful, NIL if symbol not interned
  1524.  
  1525. (defconstant <sym> <val>)                                 DEFINE A CONSTANT
  1526.      fsubr.
  1527.      <sym>     the symbol
  1528.      <val>     the value
  1529.      returns   the value
  1530.  
  1531. (defparameter <sym> <val>)                               DEFINE A PARAMETER
  1532.      fsubr.
  1533.      <sym>     the symbol
  1534.      <val>     the value
  1535.      returns   the value
  1536.  
  1537. (defvar <sym> [<val>])                                    DEFINE A VARIABLE
  1538.      fsubr. Variable only initialized if not previously defined.
  1539.      <sym>     the symbol
  1540.      <val>     the initial value, or NIL if absent.
  1541.      returns   the current value
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549. XLISP 2.1e                PROPERTY LIST FUNCTIONS                   Page 30
  1550.  
  1551.  
  1552.  
  1553. PROPERTY LIST FUNCTIONS
  1554.  
  1555. Note that property names are not limited to symbols.
  1556.  
  1557. (get <sym> <prop>)                              GET THE VALUE OF A PROPERTY
  1558.      <sym>     the symbol
  1559.      <prop>    the property symbol
  1560.      returns   the property value or NIL
  1561.  
  1562. (putprop <sym> <val> <prop>)            PUT A PROPERTY ONTO A PROPERTY LIST
  1563.      <sym>     the symbol
  1564.      <val>     the property value
  1565.      <prop>    the property symbol
  1566.      returns   the property value
  1567.  
  1568. (remprop <sym> <prop>)                                    DELETE A PROPERTY
  1569.      <sym>     the symbol
  1570.      <prop>    the property symbol
  1571.      returns   NIL
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579. XLISP 2.1e                  HASH TABLE FUNCTIONS                    Page 31
  1580.  
  1581.  
  1582.  
  1583. HASH TABLE FUNCTIONS
  1584.  
  1585. A hash table is implemented as an structure of type  hash-table. No general
  1586. accessing functions are provided, and hash tables print out using the angle
  1587. bracket  convention  (not  readable by  READ).  The  first  element is  the
  1588. comparison function.  The remaining  elements contain association  lists of
  1589. keys (that hash to the same value) and their data.
  1590.  
  1591. (make-hash-table &key :size :test)                        MAKE A HASH TABLE
  1592.      :size     size  of hash table -- should be  a prime number. Default is
  1593.                31.
  1594.      :test     comparison function. Defaults to eql.
  1595.      returns   the hash table
  1596.  
  1597. (gethash <key> <table> [<def>])                     EXTRACT FROM HASH TABLE
  1598.      See also gethash in SETF.
  1599.      <key>     hash key
  1600.      <table>   hash table
  1601.      <def>     value to return on no match (default is NIL)
  1602.      returns   associated data, if found, or <def> if not found.
  1603.  
  1604. (remhash <key> <table>)                              DELETE FROM HASH TABLE
  1605.      <key>     hash key
  1606.      <table>   hash table
  1607.      returns   T if deleted, NIL if not in table
  1608.  
  1609. (clrhash <table>)                                      CLEAR THE HASH TABLE
  1610.      <table>   hash table
  1611.      returns   NIL, all entries cleared from table
  1612.  
  1613. (hash-table-count <table>)                  NUMBER OF ENTRIES IN HASH TABLE
  1614.      <table>   hash table
  1615.      returns   integer number of entries in table
  1616.  
  1617. (maphash <fcn> <table>)                     MAP FUNCTION OVER TABLE ENTRIES
  1618.      <fcn>     the function or function name, a  function of two arguments,
  1619.                the first is  bound to the key, and the  second the value of
  1620.                each table entry in turn.
  1621.      <table>   hash table
  1622.      returns   NIL
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630. XLISP 2.1e                    ARRAY FUNCTIONS                       Page 32
  1631.  
  1632.  
  1633.  
  1634. ARRAY FUNCTIONS
  1635.  
  1636. Note that sequence functions also work on arrays.
  1637.  
  1638. (aref <array> <n>)                          GET THE NTH ELEMENT OF AN ARRAY
  1639.      See setf for setting elements of arrays
  1640.      <array>   the array (or string)
  1641.      <n>       the array index (integer, zero based)
  1642.      returns   the value of the array element
  1643.  
  1644. (make-array <size>)                                        MAKE A NEW ARRAY
  1645.      <size>    the size of the new array (integer)
  1646.      returns   the new array
  1647.  
  1648. (vector <expr>...)                               MAKE AN INITIALIZED VECTOR
  1649.      <expr>    the vector elements
  1650.      returns   the new vector
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658. XLISP 2.1e                   SEQUENCE FUNCTIONS                     Page 33
  1659.  
  1660.  
  1661.  
  1662. SEQUENCE FUNCTIONS
  1663.  
  1664. These functions work on sequences -- lists, arrays, or strings.
  1665.  
  1666. (concatenate <type> <expr> ...)                       CONCATENATE SEQUENCES
  1667.      If result type is string, sequences must contain only characters.
  1668.      <type>    result type, one of CONS, LIST, ARRAY, or STRING
  1669.      <expr>    zero or more sequences to concatenate
  1670.      returns   a  sequence  which is  the  concatenation  of the  arguement
  1671.                sequences
  1672.  
  1673. (elt <expr> <n>)                          GET THE NTH ELEMENT OF A SEQUENCE
  1674.      <expr>    the sequence
  1675.      <n>       the index of element to return
  1676.      returns   the element if the index is in bounds, otherwise error
  1677.  
  1678. (map <type> <fcn> <expr> ...)         APPLY FUNCTION TO SUCCESSIVE ELEMENTS
  1679.      <type>    result type, one of CONS, LIST, ARRAY, STRING, or NIL
  1680.      <fcn>     the function or function name
  1681.      <expr>    a sequence for each argument of the function
  1682.      returns   a new sequence of type <type>.
  1683.  
  1684. (every <fcn> <expr> ...)             APPLY FUNCTION TO ELEMENTS UNTIL FALSE
  1685. (notevery <fcn> <expr> ...)
  1686.      <fcn>     the function or function name
  1687.      <expr>    a sequence for each argument of the function
  1688.      returns   every returns last evaluated function result
  1689.                notevery returns T if  there is a NIL function  result, else
  1690.                NIL
  1691.  
  1692. (some <fcn> <expr> ...)               APPLY FUNCTION TO ELEMENTS UNTIL TRUE
  1693. (notany <fcn> <expr> ...)
  1694.      <fcn>     the function or function name
  1695.      <expr>    a sequence for each argument of the function
  1696.      returns   some returns first non-NIL function result, or NIL
  1697.                notany returns NIL  if there is  a non-NIL function  result,
  1698.                else T
  1699.  
  1700. (length <expr>)                               FIND THE LENGTH OF A SEQUENCE
  1701.      <expr>    the list, vector or string
  1702.      returns   the length of the list, vector or string
  1703.  
  1704. (reverse <expr>)                                         REVERSE A SEQUENCE
  1705. (nreverse <expr>)                          DESTRUCTIVELY REVERSE A SEQUENCE
  1706.      <expr>    the sequence to reverse
  1707.      returns   a new sequence in the reverse order
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715. XLISP 2.1e                   SEQUENCE FUNCTIONS                     Page 34
  1716.  
  1717.  
  1718. (subseq <seq> <start> [<end>])                        EXTRACT A SUBSEQUENCE
  1719.      <seq>     the sequence
  1720.      <start>   the starting position (zero origin)
  1721.      <end>     the ending position + 1 (defaults to end) or NIL  for end of
  1722.                sequence
  1723.      returns   the sequence between <start> and <end>
  1724.  
  1725. (search  <seq1> <seq2>  &key  :test :test-not  :key  :start1 :end1  :start2
  1726. :end2)
  1727.                                                         SEARCH FOR SEQUENCE
  1728.      <seq1>    the sequence to search for
  1729.      <seq2>    the sequence to search in
  1730.      :test     the test function (defaults to eql)
  1731.      :test-not the test function (sense inverted)
  1732.      :key      function to  apply to  test function arguments  (defaults to
  1733.                identity)
  1734.      :start1   starting index in <seq1>
  1735.      :end1     index of end+1 in <seq1> or NIL for end of sequence
  1736.      :start2   starting index in <seq2>
  1737.      :end2     index of end+1 in <seq2> or NIL for end of sequence
  1738.      returns   position of first match
  1739.  
  1740. (remove <expr> <seq> &key :test :test-not :key :start :end)
  1741.                                             REMOVE ELEMENTS FROM A SEQUENCE
  1742.      <expr>    the element to remove
  1743.      <seq>     the sequence
  1744.      :test     the test function (defaults to eql)
  1745.      :test-not the test function (sense inverted)
  1746.      :key      function   to  apply  to  test  function  sequence  argument
  1747.                (defaults to identity)
  1748.      :start    starting index
  1749.      :end      index of end+1, or NIL for (length <seq>)
  1750.      returns   copy of sequence with matching expressions removed
  1751.  
  1752. (remove-if <test> <seq> &key :key :start :end)
  1753.                                              REMOVE ELEMENTS THAT PASS TEST
  1754. (remove-if-not <test> <seq> &key :key :start :end)
  1755.                                              REMOVE ELEMENTS THAT FAIL TEST
  1756.      <test>    the test predicate
  1757.      <seq>     the sequence
  1758.      :key      function  to apply  to test  function argument  (defaults to
  1759.                identity)
  1760.      :start    starting index
  1761.      :end      index of end+1, or NIL for (length <seq>)
  1762.      returns   copy  of  sequence  with matching  or  non-matching elements
  1763.                removed
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771. XLISP 2.1e                   SEQUENCE FUNCTIONS                     Page 35
  1772.  
  1773.  
  1774. (count-if <test> <seq> &key :key :start :end)
  1775.                                               COUNT ELEMENTS THAT PASS TEST
  1776.      <test>    the test predicate
  1777.      <seq>     the sequence
  1778.      :key      function  to apply  to test  function argument  (defaults to
  1779.                identity)
  1780.      :start    starting index
  1781.      :end      index of end+1, or NIL for (length <seq>)
  1782.      returns   count of matching elements
  1783.  
  1784. (find-if <test> <seq> &key :key :start :end)
  1785.                                         FIND FIRST ELEMENT THAT PASSES TEST
  1786.      <test>    the test predicate
  1787.      <seq>     the list
  1788.      :key      function  to apply  to test  function argument  (defaults to
  1789.                identity)
  1790.      :start    starting index
  1791.      :end      index of end+1, or NIL for (length <seq>)
  1792.      returns   first element of sequence that passes test
  1793.  
  1794. (position-if <test> <seq> &key :key :start :end)
  1795.                             FIND POSITION OF FIRST ELEMENT THAT PASSES TEST
  1796.      <test>    the test predicate
  1797.      <seq>     the list
  1798.      :key      function  to apply  to test  function argument  (defaults to
  1799.                identity)
  1800.      :start    starting index
  1801.      :end      index of end+1, or NIL for (length <seq>)
  1802.      returns   position  of first element of sequence  that passes test, or
  1803.                NIL.
  1804.  
  1805. (delete <expr> <seq> &key :key :test :test-not :start :end)
  1806.                                             DELETE ELEMENTS FROM A SEQUENCE
  1807.      <expr>    the element to delete
  1808.      <seq>     the sequence
  1809.      :test     the test function (defaults to eql)
  1810.      :test-not the test function (sense inverted)
  1811.      :key      function  to   apply  to  test  function  sequence  argument
  1812.                (defaults to identity)
  1813.      :start    starting index
  1814.      :end      index of end+1, or NIL for (length <seq>)
  1815.      returns   the sequence with the matching expressions deleted
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823. XLISP 2.1e                   SEQUENCE FUNCTIONS                     Page 36
  1824.  
  1825.  
  1826. (delete-if <test> <seq> &key :key :start :end)
  1827.                                              DELETE ELEMENTS THAT PASS TEST
  1828. (delete-if-not <test> <seq> &key :key :start :end)
  1829.                                              DELETE ELEMENTS THAT FAIL TEST
  1830.      <test>    the test predicate
  1831.      <seq>     the sequence
  1832.      :key      function  to apply  to test  function argument  (defaults to
  1833.                identity)
  1834.      :start    starting index
  1835.      :end      index of end+1, or NIL for (length <seq>)
  1836.      returns   the sequence with matching or non-matching elements deleted
  1837.  
  1838. (reduce <fcn> <seq> &key :initial-value :start :end)
  1839.                                             REDUCE SEQUENCE TO SINGLE VALUE
  1840.      <fcn>     function (of two arguments) to  apply to result of  previous
  1841.                function application  (or first element) and  each member of
  1842.                sequence.
  1843.      <seq>     the sequence
  1844.      :initial-value      value to  use as first argument  in first function
  1845.                          application rather than using the first element of
  1846.                          the sequence.
  1847.      :start    starting index
  1848.      :end      index of end+1, or NIL for (length <seq>)
  1849.      returns   if  sequence is empty and there is no initial value, returns
  1850.                result of applying function to zero arguements. If there  is
  1851.                a single element, returns the element. Otherwise returns the
  1852.                result of the last function application.
  1853.  
  1854. (remove-duplicates <seq> &key :test :test-not :key :start :end)
  1855.                                             REMOVE DUPLICATES FROM SEQUENCE
  1856.      <seq>     the sequence
  1857.      :test     comparison function (default eql)
  1858.      :test-not comparison function (sense inverted)
  1859.      :key      function to  apply to  test function arguments  (defaults to
  1860.                identity)
  1861.      :start    starting index
  1862.      :end      index of end+1, or NIL for (length <seq>)
  1863.      returns   copy of sequence with duplicates removed.
  1864.  
  1865. (fill <seq> <expr> &key :start :end)              REPLACE ITEMS IN SEQUENCE
  1866.      Defined in common.lsp
  1867.      <seq>     the sequence
  1868.      <expr>    new value to place in sequence
  1869.      :start    starting index
  1870.      :end      index of end+1, or NIL for (length <seq>)
  1871.      returns   sequence with items replaced with new item
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879. XLISP 2.1e                   SEQUENCE FUNCTIONS                     Page 37
  1880.  
  1881.  
  1882. (replace <seq1> <seq2> &key :start1 :end1 :start2 :end2)
  1883.                                     REPLACE ITEMS IN SEQUENCE FROM SEQUENCE
  1884.      Defined in common.lsp
  1885.      <seq1>    the sequence to modify
  1886.      <seq2>    sequence with new items
  1887.      :start1   starting index in <seq1>
  1888.      :end1     index of end+1 in <seq1> or NIL for end of sequence
  1889.      :start2   starting index in <seq2>
  1890.      :end2     index of end+1 in <seq2> or NIL for end of sequence
  1891.      returns   first sequence with items replaced
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899. XLISP 2.1e                     LIST FUNCTIONS                       Page 38
  1900.  
  1901.  
  1902.  
  1903. LIST FUNCTIONS 
  1904.  
  1905. (car <expr>)                                  RETURN THE CAR OF A LIST NODE
  1906.      <expr>    the list node
  1907.      returns   the car of the list node
  1908.  
  1909. (cdr <expr>)                                  RETURN THE CDR OF A LIST NODE
  1910.      <expr>    the list node
  1911.      returns   the cdr of the list node
  1912.  
  1913. (cxxr <expr>)                                         ALL CxxR COMBINATIONS
  1914. (cxxxr <expr>)                                       ALL CxxxR COMBINATIONS
  1915. (cxxxxr <expr>)                                     ALL CxxxxR COMBINATIONS
  1916.  
  1917. (first <expr>)                                            A SYNONYM FOR CAR
  1918. (second <expr>)                                          A SYNONYM FOR CADR
  1919. (third <expr>)                                          A SYNONYM FOR CADDR
  1920. (fourth <expr>)                                        A SYNONYM FOR CADDDR
  1921. (rest <expr>)                                             A SYNONYM FOR CDR
  1922.  
  1923. (cons <expr1> <expr2>)                            CONSTRUCT A NEW LIST NODE
  1924.      <expr1>   the car of the new list node
  1925.      <expr2>   the cdr of the new list node
  1926.      returns   the new list node
  1927.  
  1928. (acons <expr1> <expr2> <alist>)                  ADD TO FRONT OF ASSOC LIST
  1929.      defined in common.lsp
  1930.      <expr1>   key of new association
  1931.      <expr2>   value of new association
  1932.      <alist>   association list
  1933.      returns   new association list, which  is (cons (cons <expr1> <expr2>)
  1934.                <expr3>))
  1935.  
  1936. (list <expr>...)                                    CREATE A LIST OF VALUES
  1937. (list* <expr> ... <list>)
  1938.      <expr>    expressions to be combined into a list
  1939.      returns   the new list
  1940.  
  1941. (append <expr>...)                                             APPEND LISTS
  1942.      <expr>    lists whose elements are to be appended
  1943.      returns   the new list
  1944.  
  1945. (last <list>)                           RETURN THE LAST LIST NODE OF A LIST
  1946.      <list>    the list
  1947.      returns   the last list node in the list
  1948.  
  1949. (butlast <list> [<n>])                  RETURN COPY OF ALL BUT LAST OF LIST
  1950.      <list>    the list
  1951.      <n>       count of elements to omit (default 1)
  1952.      returns   copy of list with last element(s) absent.
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960. XLISP 2.1e                     LIST FUNCTIONS                       Page 39
  1961.  
  1962.  
  1963. (nth <n> <list>)                           RETURN THE NTH ELEMENT OF A LIST
  1964.      <n>       the number of the element to return (zero origin)
  1965.      <list>    the list
  1966.      returns   the nth element or NIL if the list isn't that long
  1967.  
  1968. (nthcdr <n> <list>)                            RETURN THE NTH CDR OF A LIST
  1969.      <n>       the number of the element to return (zero origin)
  1970.      <list>    the list
  1971.      returns   the nth cdr or NIL if the list isn't that long
  1972.  
  1973. (member <expr> <list> &key :test :test-not :key)
  1974.                                                FIND AN EXPRESSION IN A LIST
  1975.      <expr>    the expression to find
  1976.      <list>    the list to search
  1977.      :test     the test function (defaults to eql)
  1978.      :test-not the test function (sense inverted)
  1979.      :key      function to  apply to test function  list argument (defaults
  1980.                to identity)
  1981.      returns   the remainder of the list starting with the expression
  1982.  
  1983. (assoc <expr> <alist> &key :test :test-not :key)
  1984.                                             FIND AN EXPRESSION IN AN A-LIST
  1985.      <expr>    the expression to find
  1986.      <alist>   the association list
  1987.      :test     the test function (defaults to eql)
  1988.      :test-not the test function (sense inverted)
  1989.      :key      function to  apply to test function  list argument (defaults
  1990.                to identity)
  1991.      returns   the alist entry or NIL
  1992.  
  1993. (mapc <fcn> <list1> <list>...)            APPLY FUNCTION TO SUCCESSIVE CARS
  1994.      <fcn>     the function or function name
  1995.      <listn>   a list for each argument of the function
  1996.      returns   the first list of arguments
  1997.  
  1998. (mapcar <fcn> <list1> <list>...)          APPLY FUNCTION TO SUCCESSIVE CARS
  1999.      <fcn>     the function or function name
  2000.      <listn>   a list for each argument of the function
  2001.      returns   a list of the values returned
  2002.  
  2003. (mapl <fcn> <list1> <list>...)            APPLY FUNCTION TO SUCCESSIVE CDRS
  2004.      <fcn>     the function or function name
  2005.      <listn>   a list for each argument of the function
  2006.      returns   the first list of arguments
  2007.  
  2008. (maplist <fcn> <list1> <list>...)         APPLY FUNCTION TO SUCCESSIVE CDRS
  2009.      <fcn>     the function or function name
  2010.      <listn>   a list for each argument of the function
  2011.      returns   a list of the values returned
  2012.  
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019. XLISP 2.1e                     LIST FUNCTIONS                       Page 40
  2020.  
  2021.  
  2022. (mapcan <fcn> <list1> <list>...)           APPL FUNCTION TO SUCCESSIVE CARS
  2023.      <fcn>     the function or function name
  2024.      <listn>   a list for each argument of the function
  2025.      returns   list of return values nconc'd together
  2026.  
  2027. (mapcon <fcn> <list1> <list>...)           APPL FUNCTION TO SUCCESSIVE CDRS
  2028.      <fcn>     the function or function name
  2029.      <listn>   a list for each argument of the function
  2030.      returns   list of return values nconc'd together
  2031.  
  2032. (subst <to> <from> <expr> &key :test :test-not :key)
  2033.                                                      SUBSTITUTE EXPRESSIONS
  2034.      Does minimum copying as required by Common Lisp
  2035.      <to>      the new expression
  2036.      <from>    the old expression
  2037.      <expr>    the expression in which to do the substitutions
  2038.      :test     the test function (defaults to eql)
  2039.      :test-not the test function (sense inverted)
  2040.      :key      function  to  apply  to test  function  expression  argument
  2041.                (defaults to identity)
  2042.      returns   the expression with substitutions
  2043.  
  2044. (sublis <alist> <expr> &key :test :test-not :key)
  2045.                                                   SUBSTITUTE WITH AN A-LIST
  2046.      Does minimum copying as required by Common Lisp
  2047.      <alist>   the association list
  2048.      <expr>    the expression in which to do the substitutions
  2049.      :test     the test function (defaults to eql)
  2050.      :test-not the test function (sense inverted)
  2051.      :key      function  to  apply  to  test function  expression  argument
  2052.                (defaults to identity)
  2053.      returns   the expression with substitutions
  2054.  
  2055. (pairlis <keys> <values> [<alist>])          BUILD AN A-LIST FROM TWO LISTS
  2056.      In file common.lsp
  2057.      <keys>    list of association keys
  2058.      <values>  list of association values, same length as keys
  2059.      <alist>   existing association list, default NIL
  2060.      returns   new association list
  2061.  
  2062. (copy-list <list>)                             COPY THE TOP LEVEL OF A LIST
  2063.      In file common.lsp
  2064.      <list>    the list
  2065.      returns   a copy of the list (new cons cells in top level)
  2066.  
  2067. (copy-alist <alist>)                               COPY AN ASSOCIATION LIST
  2068.      In file common.lsp
  2069.      <alist>   the association list
  2070.      returns   a copy of the association list (keys and values not copies)
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078. XLISP 2.1e                     LIST FUNCTIONS                       Page 41
  2079.  
  2080.  
  2081. (copy-tree <tree>)                                              COPY A TREE
  2082.      In file common.lsp
  2083.      <tree>    a tree structure of cons cells
  2084.      returns   a copy of the tree structure
  2085.  
  2086. (intersection <list1> <list2> &key :test :test-not :key)      SET FUNCTIONS
  2087. (union <list1> <list2> &key :test :test-not :key)
  2088. (set-difference <list1> <list2> &key :test :test-not :key)
  2089. (set-exclusive-or <list1> <list2> &key :test :test-not :key)
  2090. (nintersection <list1> <list2> &key :test :test-not :key)
  2091. (nunion <list1> <list2> &key :test :test-not :key)
  2092. (nset-difference <list1> <list2> &key :test :test-not :key)
  2093. (nset-exclusive-or <list1> <list2> &key :test :test-not :key)
  2094.      set-exclusive-or and nset-exclusive-or  defined in common.lsp. nunion,
  2095.      nintersection,    and   nset-difference    are   aliased    to   their
  2096.      non-destructive counterparts in common.lsp.
  2097.      <list1>   first list
  2098.      <list2>   second list
  2099.      :test     the test function (defaults to eql)
  2100.      :test-not the test function (sense inverted)
  2101.      :key      function to  apply to  test function arguments  (defaults to
  2102.                identity)
  2103.      returns   intersection: list of all elements in both lists
  2104.                union: list of all elements in either list
  2105.                set-diference: list of all elements in first list but not in
  2106.                second list
  2107.                set-exclusive-or: list of all elements in only one list
  2108.                "n" versions are potentially destructive.
  2109.  
  2110. (adjoin <expr> <list> :test :test-not :key)              ADD UNIQUE TO LIST
  2111.      <expr>    new element to add
  2112.      <list>    the list
  2113.      :test     the test function (defaults to eql)
  2114.      :test-not the test function <sense inverted)
  2115.      :key      function to  apply to  test function arguments  (defaults to
  2116.                identity)
  2117.      returns   if  element  not in  list  then (cons  <expr>  <list>), else
  2118.                <list>.
  2119.  
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126. XLISP 2.1e               DESTRUCTIVE LIST FUNCTIONS                 Page 42
  2127.  
  2128.  
  2129.  
  2130. DESTRUCTIVE LIST FUNCTIONS
  2131.  
  2132. See  also nreverse,  delete,  delete-if, delete-if-not,  fill, and  replace
  2133. under SEQUENCE  FUNCTIONS, setf under SYMBOL  FUNCTIONS, and nintersection,
  2134. nunion, nset-difference, and nset-exclusive-or under LIST FUNCTIONS.
  2135.  
  2136. (rplaca <list> <expr>)                       REPLACE THE CAR OF A LIST NODE
  2137.      <list>    the list node
  2138.      <expr>    the new value for the car of the list node
  2139.      returns   the list node after updating the car
  2140.  
  2141. (rplacd <list> <expr>)                       REPLACE THE CDR OF A LIST NODE
  2142.      <list>    the list node
  2143.      <expr>    the new value for the cdr of the list node
  2144.      returns   the list node after updating the cdr
  2145.  
  2146. (nconc <list>...)                           DESTRUCTIVELY CONCATENATE LISTS
  2147.      <list>    lists to concatenate
  2148.      returns   the result of concatenating the lists
  2149.  
  2150. (sort <list> <test> &key :key)                                  SORT A LIST
  2151.      <list>    the list to sort
  2152.      <test>    the comparison function
  2153.      :key      function to apply to comparison function arguments (defaults
  2154.                to identity)
  2155.      returns   the sorted list
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163. XLISP 2.1e                  ARITHMETIC FUNCTIONS                    Page 43
  2164.  
  2165.  
  2166.  
  2167. ARITHMETIC FUNCTIONS
  2168.  
  2169. Warning: integer and ratio calculations that overflow become floating point
  2170. values  as part  of the  math extension,  but give  no error  otherwise. On
  2171. systems with  IEEE floating  point, the  values +INF  and -INF  result from
  2172. overflowing floating point calculations.
  2173.  
  2174. The  math extension option adds complex numbers, ratios, new functions, and
  2175. additional functionality to some existing functions. Because of the size of
  2176. the extension, and the performance loss it entails, some users may not wish
  2177. to include  it. This  section documents  the math  functions both  with and
  2178. without the extension.
  2179.  
  2180. Functions  that are described as  having floating point  arguments (SIN COS
  2181. TAN  ASIN ACOS ATAN EXPT EXP SQRT) will take arguments of any type (real or
  2182. complex)  when the math extension  is used. In  the descriptions, "rational
  2183. number" means integer  or ratio   only,  and "real  number" means  floating
  2184. point number or rational only.
  2185.  
  2186. Any  rational  results  are  reduced to  canonical  form  (the  gcd of  the
  2187. numerator  and denominator  is 1,  the denominator  is  positive); integral
  2188. results  are  reduced  to  integers.  Integer  complex  numbers  with  zero
  2189. imaginary parts are reduced to integers.
  2190.  
  2191. (truncate <expr> <denom>)                             TRUNCATES TOWARD ZERO
  2192. (round <expr> <denom>)                        ROUNDS TOWARD NEAREST INTEGER
  2193. (floor <expr> <denom>)                   TRUNCATES TOWARD NEGATIVE INFINITY
  2194. (ceiling <expr> <denom>)                          TRUNCATES TOWARD INFINITY
  2195.      Round,  floor, and ceiling, and  the second argument  of truncate, are
  2196.      part  of the  math extension.  Results  too big  to be  represented as
  2197.      integers are  returned as floating point  numbers as part  of the math
  2198.      extension. Integers are returned as is.
  2199.      <expr>    the real number
  2200.      <denom>   real number to divide <expr> by before converting
  2201.      returns   the integer result of converting the number
  2202.  
  2203. (float <expr>)               CONVERTS AN INTEGER TO A FLOATING POINT NUMBER
  2204.      <expr>    the real number
  2205.      returns   the number as a floating point number
  2206.  
  2207. (rational <expr>)                      CONVERTS A REAL NUMBER TO A RATIONAL
  2208.      Floating  point numbers too large to express return the floating point
  2209.      number,  while numbers  too  small to  express  return zero.  Rational
  2210.      numbers are returned as is.
  2211.      <expr>    the real number
  2212.      returns   the number as a ratio or integer. 
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220. XLISP 2.1e                  ARITHMETIC FUNCTIONS                    Page 44
  2221.  
  2222.  
  2223. (+ [<expr>...])                                       ADD A LIST OF NUMBERS
  2224.      With no arguments returns addition identity, 0 (integer)
  2225.      <expr>    the numbers
  2226.      returns   the result of the addition
  2227.  
  2228. (- <expr>...)          SUBTRACT A LIST OF NUMBERS OR NEGATE A SINGLE NUMBER
  2229.      <expr>    the numbers
  2230.      returns   the result of the subtraction
  2231.  
  2232. (* [<expr>...])                                  MULTIPLY A LIST OF NUMBERS
  2233.      With no arguments returns multiplication identity, 1
  2234.      <expr>    the numbers
  2235.      returns   the result of the multiplication
  2236.  
  2237. (/ <expr>...)            DIVIDE A LIST OF NUMBERS OR INVERT A SINGLE NUMBER
  2238.      With  the math  extension, division  of integer  numbers results  in a
  2239.      rational quotient,  rather than integer. To  perform integer division,
  2240.      use TRUNCATE. When  an integer complex is  divided by an integer,  the
  2241.      quotient is floating point complex.
  2242.      <expr>    the numbers
  2243.      returns   the result of the division
  2244.  
  2245. (1+ <expr>)                                             ADD ONE TO A NUMBER
  2246.      <expr>    the number
  2247.      returns   the number plus one
  2248.  
  2249. (1- <expr>)                                      SUBTRACT ONE FROM A NUMBER
  2250.      <expr>    the number
  2251.      returns   the number minus one
  2252.  
  2253. (rem <expr>...)                              REMAINDER OF A LIST OF NUMBERS
  2254.      With the math extension, only two arguments allowed.
  2255.      <expr>    the real numbers (must be integers, without math extension)
  2256.      returns   the  result  of  the  remainder  operation  (remainder  with
  2257.                truncating division)
  2258.  
  2259. (mod <expr1> <expr2>)                          NUMBER MODULO ANOTHER NUMBER
  2260.      Part of math extension.
  2261.      <expr1>   real number
  2262.      <expr2>   real number divisor (may not be zero)
  2263.      returns   the  remainder  after  dividing  <expr1>  by  <expr2>  using
  2264.                flooring  division, thus  there is  no discontinuity  in the
  2265.                function around zero.
  2266.  
  2267. (min <expr>...)                           THE SMALLEST OF A LIST OF NUMBERS
  2268.      <expr>    the real numbers
  2269.      returns   the smallest number in the list
  2270.  
  2271. (max <expr>...)                            THE LARGEST OF A LIST OF NUMBERS
  2272.      <expr>    the real numbers
  2273.      returns   the largest number in the list
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281. XLISP 2.1e                  ARITHMETIC FUNCTIONS                    Page 45
  2282.  
  2283.  
  2284. (abs <expr>)                                 THE ABSOLUTE VALUE OF A NUMBER
  2285.      <expr>    the number
  2286.      returns   the  absolute value  of the  number,  which is  the floating
  2287.                point magnitude for complex numbers.
  2288.  
  2289. (signum <expr>)                                    GET THE SIGN OF A NUMBER
  2290.      Defined in common.lsp
  2291.      <expr>    the number
  2292.      returns   zero if number is zero, one if positive, or negative one  if
  2293.                negative.  Numeric  type is  same as  number. For  a complex
  2294.                number, returns unit magnitude but same phase as number.
  2295.  
  2296. (gcd [<n>...])                          COMPUTE THE GREATEST COMMON DIVISOR
  2297.      With no arguments returns 0, with one argument returns the argument.
  2298.      <n>       The number(s) (integer)
  2299.      returns   the greatest common divisor
  2300.  
  2301. (lcm <n>...)                              COMPUTE THE LEAST COMMON MULTIPLE
  2302.      Part  of math  extension.  A result  which  would be  larger than  the
  2303.      largest integer causes an error.
  2304.      <n>       The number(s) (integer)
  2305.      returns   the least common multiple
  2306.  
  2307. (random <n> [<state>])                       COMPUTE A PSEUDO-RANDOM NUMBER
  2308.      <n>       the real number upper bound
  2309.      <state>   a random-state (default is *random-state*)
  2310.      returns   a random number in range [0,n)
  2311.  
  2312. (make-random-state [<state>])                         CREATE A RANDOM-STATE
  2313.      <state>   a  random-state,   t,  or  NIL  (default   NIL).  NIL  means
  2314.                *random-state*
  2315.      returns   If  <state> is t, a random random-state, otherwise a copy of
  2316.                <state>
  2317.  
  2318. (sin <expr>)                                   COMPUTE THE SINE OF A NUMBER
  2319. (cos <expr>)                                 COMPUTE THE COSINE OF A NUMBER
  2320. (tan <expr>)                                COMPUTE THE TANGENT OF A NUMBER
  2321. (asin <expr>)                              COMPUTE THE ARC SINE OF A NUMBER
  2322. (acos <expr>)                            COMPUTE THE ARC COSINE OF A NUMBER
  2323.      <expr>    the floating point number
  2324.      returns   the  sine, cosine, tangent, arc  sine, or arc  cosine of the
  2325.                number
  2326.  
  2327. (atan <expr> [<expr2>])                 COMPUTE THE ARC TANGENT OF A NUMBER
  2328.      <expr>    the floating point number (numerator)
  2329.      <expr2>   the denominator, default  1. May only  be specified if  math
  2330.                extension installed
  2331.      returns   the arc tangent of <expr>/<expr2>
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.  
  2338.  
  2339. XLISP 2.1e                  ARITHMETIC FUNCTIONS                    Page 46
  2340.  
  2341.  
  2342. (sinh <expr>)                       COMPUTE THE HYPERBOLIC SINE OF A NUMBER
  2343. (cosh <expr>)                     COMPUTE THE HYPERBOLIC COSINE OF A NUMBER
  2344. (tanh <expr>)                    COMPUTE THE HYPERBOLIC TANGENT OF A NUMBER
  2345. (asinh <expr>)                  COMPUTE THE HYPERBOLIC ARC SINE OF A NUMBER
  2346. (acosh <expr>)                COMPUTE THE HYPERBOLIC ARC COSINE OF A NUMBER
  2347. (atanh <expr>)               COMPUTE THE HYPERBOLIC ARC TANGENT OF A NUMBER
  2348.      Defined in common.lsp
  2349.      <expr>    the number
  2350.      returns   the hyperbolic sine, cosine,  tangent, arc sine, arc cosine,
  2351.                or arc tangent of the number.
  2352.  
  2353. (expt <x-expr> <y-expr>)                           COMPUTE X TO THE Y POWER
  2354.      <x-expr>  the number 
  2355.      <y-expr>  the exponent 
  2356.      returns   x to the y power. If y is a fixnum, then  the result type is
  2357.                the same as  the type of  x, unless fixnum  or ratio and  it
  2358.                would overflow, then the result type is a flonum.
  2359.  
  2360. (exp <x-expr>)                                     COMPUTE E TO THE X POWER
  2361.      <x-expr>  the floating point number 
  2362.      returns   e to the x power
  2363.  
  2364. (cis <x-expr>)                                      COMPUTE COSINE + I SINE
  2365.      Defined in common.lsp
  2366.      <x-expr>  the number
  2367.      returns   e to the ix power
  2368.  
  2369. (log <expr> [<base>])                                  COMPUTE THE LOGRITHM
  2370.      Part of the math extension
  2371.      <expr>    the number
  2372.      <base>    the base, default is e
  2373.      returns   log base <base> of <expr>
  2374.  
  2375. (sqrt <expr>)                           COMPUTE THE SQUARE ROOT OF A NUMBER
  2376.      <expr>    the number 
  2377.      returns   the square root of the number
  2378.  
  2379. (numerator <expr>)                            GET THE NUMERATOR OF A NUMBER
  2380.      Part of math extension
  2381.      <expr>    rational number
  2382.      returns   numerator of number (number if integer)
  2383.  
  2384. (denominator <expr>)                        GET THE DENOMINATOR OF A NUMBER
  2385.      Part of math extension
  2386.      <expr>    rational number
  2387.      returns   denominator of number (1 if integer)
  2388.  
  2389.  
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395. XLISP 2.1e                  ARITHMETIC FUNCTIONS                    Page 47
  2396.  
  2397.  
  2398. (complex <real> [<imag>])                         CONVERT TO COMPLEX NUMBER
  2399.      Part of math extension
  2400.      <real>    real number real part
  2401.      <imag>    real number imaginary part (default 0)
  2402.      returns   the complex number
  2403.  
  2404. (realpart <expr>)                             GET THE REAL PART OF A NUMBER
  2405.      Part of the math extension
  2406.      <expr>    the number
  2407.      returns   the real part of a complex number, or the number itself if a
  2408.      real number
  2409.  
  2410. (imagpart <expr>)                        GET THE IMAGINARY PART OF A NUMBER
  2411.      Part of the math extension
  2412.      <expr>    the number
  2413.      returns   the imaginary part  of a complex number, or zero of the type
  2414.                of the number if a real number.
  2415.  
  2416. (conjugate <expr>)                            GET THE CONJUGATE OF A NUMBER
  2417.      Part of the math extension
  2418.      <expr>    the number
  2419.      returns   the conjugate of a complex number, or the number itself if a
  2420.      real number.
  2421.  
  2422. (phase <expr>)                                    GET THE PHASE OF A NUMBER
  2423.      Part of the math extension
  2424.      <expr>    the number
  2425.      returns   the  phase  angle,  equivalent to  (atan  (imagpart  <expr>)
  2426.                (realpart <expr>))
  2427.  
  2428. (< <n1> <n2>...)                                         TEST FOR LESS THAN
  2429. (<= <n1> <n2>...)                            TEST FOR LESS THAN OR EQUAL TO
  2430. (= <n1> <n2>...)                                          TEST FOR EQUAL TO
  2431. (/= <n1> <n2>...)                                     TEST FOR NOT EQUAL TO
  2432. (>= <n1> <n2>...)                         TEST FOR GREATER THAN OR EQUAL TO
  2433. (> <n1> <n2>...)                                      TEST FOR GREATER THAN
  2434.      <n1>      the first real number to compare
  2435.      <n2>      the second real number to compare
  2436.      returns   the result of comparing <n1> with <n2>...
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444. XLISP 2.1e               BITWISE LOGICAL FUNCTIONS                  Page 48
  2445.  
  2446.  
  2447.  
  2448. BITWISE LOGICAL FUNCTIONS
  2449.  
  2450. (logand [<expr>...])                  THE BITWISE AND OF A LIST OF INTEGERS
  2451.      With no arguments returns identity -1
  2452.      <expr>    the integers
  2453.      returns   the result of the and operation
  2454.  
  2455. (logior [<expr>...])         THE BITWISE INCLUSIVE OR OF A LIST OF INTEGERS
  2456.      With no arguments returns identity 0
  2457.      <expr>    the integers
  2458.      returns   the result of the inclusive or operation
  2459.  
  2460. (logxor [<expr>...])         THE BITWISE EXCLUSIVE OR OF A LIST OF INTEGERS
  2461.      With no arguments returns identity 0
  2462.      <expr>    the integers
  2463.      returns   the result of the exclusive or operation
  2464.  
  2465. (lognot <expr>)                                THE BITWISE NOT OF A INTEGER
  2466.      <expr>    the integer
  2467.      returns   the bitwise inversion of integer
  2468.  
  2469. (logtest <expr1> <expr2>)                  TEST BITWISE AND OF TWO INTEGERS
  2470.      Defined in common.lsp
  2471.      <expr1>   the first integer
  2472.      <expr2>   the second integer
  2473.      returns   T if the result of the and operation is non-zero, else NIL
  2474.  
  2475. (ash <expr1> <expr2>)                                      ARITHMETIC SHIFT
  2476.      Part of math extension
  2477.      <expr1>   integer to shift
  2478.      <expr2>   number of bit positions to shift (positive is to left)
  2479.      returns   shifted integer
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487. XLISP 2.1e                    STRING FUNCTIONS                      Page 49
  2488.  
  2489.  
  2490.  
  2491. STRING FUNCTIONS
  2492.  
  2493. Note:  functions with names starting "string" will also accept a symbol, in
  2494. which case the symbol's print name is used.
  2495.  
  2496. (string <expr>)                   MAKE A STRING FROM AN INTEGER ASCII VALUE
  2497.      <expr>    an  integer  (which  is   first  converted  into  its  ASCII
  2498.                character value), string, character, or symbol
  2499.      returns   the string representation of the argument
  2500.  
  2501. (string-trim <bag> <str>)                        TRIM BOTH ENDS OF A STRING
  2502.      <bag>     a string containing characters to trim
  2503.      <str>     the string to trim
  2504.      returns   a trimed copy of the string
  2505.  
  2506. (string-left-trim <bag> <str>)                TRIM THE LEFT END OF A STRING
  2507.      <bag>     a string containing characters to trim
  2508.      <str>     the string to trim
  2509.      returns   a trimed copy of the string
  2510.  
  2511. (string-right-trim <bag> <str>)              TRIM THE RIGHT END OF A STRING
  2512.      <bag>     a string containing characters to trim
  2513.      <str>     the string to trim
  2514.      returns   a trimed copy of the string
  2515.  
  2516. (string-upcase <str> &key :start :end)                 CONVERT TO UPPERCASE
  2517.      <str>     the string
  2518.      :start    the starting offset
  2519.      :end      the ending offset + 1 or NIL for end of string
  2520.      returns   a converted copy of the string
  2521.  
  2522. (string-downcase <str> &key :start :end)               CONVERT TO LOWERCASE
  2523.      <str>     the string
  2524.      :start    the starting offset
  2525.      :end      the ending offset + 1 or NIL for end of string
  2526.      returns   a converted copy of the string
  2527.  
  2528. (nstring-upcase <str> &key :start :end)                CONVERT TO UPPERCASE
  2529.      <str>     the string
  2530.      :start    the starting offset
  2531.      :end      the ending offset + 1 or NIL for end of string
  2532.      returns   the converted string (not a copy)
  2533.  
  2534. (nstring-downcase <str> &key :start :end)              CONVERT TO LOWERCASE
  2535.      <str>     the string
  2536.      :start    the starting offset
  2537.      :end      the ending offset + 1 or NIL for end of string
  2538.      returns   the converted string (not a copy)
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546. XLISP 2.1e                    STRING FUNCTIONS                      Page 50
  2547.  
  2548.  
  2549. (strcat <expr>...)                                      CONCATENATE STRINGS
  2550.      Macro in init.lsp, to maintain compatibility with XLISP.
  2551.      See CONCATENATE for preferred function.
  2552.      <expr>    the strings to concatenate
  2553.      returns   the result of concatenating the strings
  2554.  
  2555. (string< <str1> <str2> &key :start1 :end1 :start2 :end2)
  2556. (string<= <str1> <str2> &key :start1 :end1 :start2 :end2)
  2557. (string= <str1> <str2> &key :start1 :end1 :start2 :end2)
  2558. (string/= <str1> <str2> &key :start1 :end1 :start2 :end2)
  2559. (string>= <str1> <str2> &key :start1 :end1 :start2 :end2)
  2560. (string> <str1> <str2> &key :start1 :end1 :start2 :end2)
  2561.      <str1>    the first string to compare
  2562.      <str2>    the second string to compare
  2563.      :start1   first substring starting offset
  2564.      :end1     first substring ending offset + 1 or NIL for end of string
  2565.      :start2   second substring starting offset
  2566.      :end2     second substring ending offset + 1 or NIL for end of string
  2567.      returns   string=: t if predicate is true, NIL otherwise
  2568.                others: If predicate is true then number of initial matching
  2569.                characters, else NIL
  2570.      Note: case is significant with these comparison functions.
  2571.  
  2572. (string-lessp <str1> <str2> &key :start1 :end1 :start2 :end2)
  2573. (string-not-greaterp <str1> <str2> &key :start1 :end1 :start2 :end2)
  2574. (string-equal <str1> <str2> &key :start1 :end1 :start2 :end2)
  2575. (string-not-equal <str1> <str2> &key :start1 :end1 :start2 :end2)
  2576. (string-not-lessp <str1> <str2> &key :start1 :end1 :start2 :end2)
  2577. (string-greaterp <str1> <str2> &key :start1 :end1 :start2 :end2)
  2578.      <str1>    the first string to compare
  2579.      <str2>    the second string to compare
  2580.      :start1   first substring starting offset
  2581.      :end1     first substring ending offset + 1 or NIL for end of string
  2582.      :start2   second substring starting offset
  2583.      :end2     second substring ending offset + 1 or NIL for end of string
  2584.      returns   string-equal: t if predicate is true, NIL otherwise
  2585.                others: If predicate is true then number of initial matching
  2586.                characters, else NIL
  2587.      Note: case is not  significant with these comparison functions  -- all
  2588.      uppercase characters are converted to lowercase before being compared.
  2589.  
  2590.  
  2591.  
  2592.  
  2593.  
  2594.  
  2595.  
  2596. XLISP 2.1e                  CHARACTER FUNCTIONS                     Page 51
  2597.  
  2598.  
  2599.  
  2600. CHARACTER FUNCTIONS
  2601.  
  2602. (char <string> <index>)                   EXTRACT A CHARACTER FROM A STRING
  2603.      <string>  the string
  2604.      <index>   the string index (zero relative)
  2605.      returns   the ascii code of the character
  2606.  
  2607. (alphanumericp <chr>)                       IS THIS CHARACTER ALPHANUMERIC?
  2608.      <chr>     the character
  2609.      returns   true  if  the  character   is  alphabetic  or  numeric,  NIL
  2610.                otherwise
  2611.  
  2612. (upper-case-p <chr>)                       IS THIS AN UPPER CASE CHARACTER?
  2613.      <chr>     the character
  2614.      returns   true if the character is upper case, NIL otherwise
  2615.  
  2616. (lower-case-p <chr>)                        IS THIS A LOWER CASE CHARACTER?
  2617.      <chr>     the character
  2618.      returns   true if the character is lower case, NIL otherwise
  2619.  
  2620. (alpha-char-p <chr>)                       IS THIS AN ALPHABETIC CHARACTER?
  2621.      <chr>     the character
  2622.      returns   true if the character is alphabetic, NIL otherwise
  2623.  
  2624. (both-case-p <chr>)          IS THIS AN ALPHABETIC (EITHER CASE) CHARACTER?
  2625.      <chr>     the character
  2626.      returns   true  if  the  character is  available  in  both cases,  NIL
  2627.                otherwise
  2628.  
  2629. (digit-char-p <chr>)                             IS THIS A DIGIT CHARACTER?
  2630.      <chr>     the character
  2631.      returns   the digit weight if character is a digit, NIL otherwise
  2632.  
  2633. (char-code <chr>)                         GET THE ASCII CODE OF A CHARACTER
  2634.      <chr>     the character
  2635.      returns   the ASCII character code (integer, parity bit stripped)
  2636.  
  2637. (code-char <code>)             GET THE CHARACTER WITH A SPECFIED ASCII CODE
  2638.      <code>    the ASCII code (integer, range 0-127)
  2639.      returns   the character with that code or NIL
  2640.  
  2641. (char-upcase <chr>)                       CONVERT A CHARACTER TO UPPER CASE
  2642.      <chr>     the character
  2643.      returns   the  upper case  version of  the character,  if one  exists,
  2644.                otherwise returns the character
  2645.  
  2646. (char-downcase <chr>)                     CONVERT A CHARACTER TO LOWER CASE
  2647.      <chr>     the character
  2648.      returns   the  lower case  version of  the character,  if one  exists,
  2649.                otherwise returns the character
  2650.  
  2651.  
  2652.  
  2653.  
  2654.  
  2655.  
  2656.  
  2657. XLISP 2.1e                  CHARACTER FUNCTIONS                     Page 52
  2658.  
  2659.  
  2660. (digit-char <n>)                          CONVERT A DIGIT WEIGHT TO A DIGIT
  2661.      <n>       the digit weight (integer)
  2662.      returns   the digit character or NIL
  2663.  
  2664. (char-int <chr>)                          CONVERT A CHARACTER TO AN INTEGER
  2665.      <chr>     the character
  2666.      returns   the ASCII character code (range 0-255)
  2667.  
  2668. (int-char <int>)                          CONVERT AN INTEGER TO A CHARACTER
  2669.      <int>     the ASCII character code (treated modulo 256)
  2670.      returns   the character with that code
  2671.  
  2672. (char< <chr1> <chr2>...)
  2673. (char<= <chr1> <chr2>...)
  2674. (char= <chr1> <chr2>...)
  2675. (char/= <chr1> <chr2>...)
  2676. (char>= <chr1> <chr2>...)
  2677. (char> <chr1> <chr2>...)
  2678.      <chr1>    the first character to compare
  2679.      <chr2>    the second character(s) to compare
  2680.      returns   t if predicate is true, NIL otherwise
  2681.      Note: case is significant with these comparison functions.
  2682.  
  2683. (char-lessp <chr1> <chr2>...)
  2684. (char-not-greaterp <chr1> <chr2>...)
  2685. (char-equal <chr1> <chr2>...)
  2686. (char-not-equal <chr1> <chr2>...)
  2687. (char-not-lessp <chr1> <chr2>...)
  2688. (char-greaterp <chr1> <chr2>...)
  2689.      <chr1>    the first string to compare
  2690.      <chr2>    the second string(s) to compare
  2691.      returns   t if predicate is true, NIL otherwise
  2692.      Note: case is not  significant with these comparison functions  -- all
  2693.      uppercase characters are converted to lowercase before the comparison.
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701. XLISP 2.1e                  STRUCTURE FUNCTIONS                     Page 53
  2702.  
  2703.  
  2704.  
  2705. STRUCTURE FUNCTIONS
  2706.  
  2707. XLISP provides a subset  of the Common Lisp structure  definition facility.
  2708. No  slot options  are allowed,  but slots  can have  default initialization
  2709. expressions.
  2710.  
  2711.      (defstruct name <slot-desc>...)
  2712. or
  2713.      (defstruct (name <option>...) <slot-desc>...)
  2714.                fsubr
  2715.                <name>              the structure name symbol (quoted)
  2716.                <option>            option description (quoted)
  2717.                <slot-desc>         slot descriptions (quoted)
  2718.                returns             the structure name
  2719.  
  2720. The recognized options are:
  2721.  
  2722.      (:conc-name name)
  2723.      (:include name [<slot-desc>...])
  2724.      (:print-function <function>)
  2725.  
  2726. Note that if :CONC-NAME appears, it should be before :INCLUDE.
  2727.  
  2728. Each slot description takes the form:
  2729.  
  2730.      <name>
  2731. or
  2732.      (<name> <defexpr>)
  2733.  
  2734. If the default initialization expression is not specified, the slot will be
  2735. initialized  to NIL  if  no  keyword argument  is  passed to  the  creation
  2736. function.
  2737.  
  2738. The  optional  :PRINT-FUNCTION  overrides  the  default  #S  notation.  The
  2739. function must take three arguments, the structure instance, the stream, and
  2740. the current printing depth.
  2741.  
  2742. DEFSTRUCT causes access functions to  be created for each of the  slots and
  2743. also arranges that SETF  will work with those access functions.  The access
  2744. function  names are constructed by  taking the structure  name, appending a
  2745. '-' and then appending the slot  name. This can be overridden by using  the
  2746. :CONC-NAME option.
  2747.  
  2748. DEFSTRUCT also makes  a creation function called  MAKE-<structname>, a copy
  2749. function   called  COPY-<structname>  and   a  predicate   function  called
  2750. <structname>-P.  The creation function takes keyword  arguments for each of
  2751. the slots. Structures can be created using the #S( read macro, as well.
  2752.  
  2753. The  property  *struct-slots*  is  added  to  the  symbol  that  names  the
  2754. structure. This property consists of an association  list of slot names and
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762. XLISP 2.1e                  STRUCTURE FUNCTIONS                     Page 54
  2763.  
  2764.  
  2765. closures  that evaluate  to the  initial values  (NIL if  no initial  value
  2766. expression).
  2767.  
  2768. For instance:
  2769.  
  2770.      (defstruct foo bar (gag 2))
  2771.  
  2772. creates the following functions:
  2773.  
  2774.      (foo-bar <expr>)
  2775.      (setf (foo-bar <expr>) <value>)
  2776.      (foo-gag <expr>)
  2777.      (setf (foo-gag <expr>) <value>)
  2778.      (make-foo &key :bar :gag)
  2779.      (copy-foo <expr>)
  2780.      (foo-p <expr>)
  2781.  
  2782.  
  2783.  
  2784.  
  2785.  
  2786.  
  2787.  
  2788. XLISP 2.1e                    OBJECT FUNCTIONS                      Page 55
  2789.  
  2790.  
  2791.  
  2792. OBJECT FUNCTIONS
  2793.  
  2794. Note  that the  functions  provided  in  classes.lsp  are  useful  but  not
  2795. necessary.
  2796.  
  2797. Messages defined for Object and Class are listed starting on page 19.
  2798.  
  2799. (send <object> <message> [<args>...])                        SEND A MESSAGE
  2800.      <object>  the object to receive the message
  2801.      <message> message sent to object
  2802.      <args>    arguments to method (if any)
  2803.      returns   the result of the method
  2804.  
  2805. (send-super <message> [<args>])                SEND A MESSAGE TO SUPERCLASS
  2806.      valid only in method context
  2807.      <message> message sent to method's superclass
  2808.      <args>    arguments to method (if any)
  2809.      returns   the result of the method
  2810.  
  2811. (defclass <sym> <ivars> [<cvars> [<super>]])             DEFINE A NEW CLASS
  2812.      defined in class.lsp as a macro
  2813.      <sym>     symbol  whose value  is  to be  bound  to the  class  object
  2814.                (quoted)
  2815.      <ivars>   list  of instance  variables  (quoted).  Instance  variables
  2816.                specified  either as  <ivar> or  (<ivar> <init>)  to specify
  2817.                non-NIL default initial value.
  2818.      <cvars>   list of class variables (quoted)
  2819.      <super>   superclass, or Object if absent.
  2820.      This function  sends :SET-PNAME  (defined in classes.lsp)  to the  new
  2821.      class to set the class' print name instance variable.
  2822.      Methods defined for classes defined with defclass:
  2823.      (send <object> :<ivar>)
  2824.                Returns the specified instance variable
  2825.      (send <object> :SET-IVAR <ivar> <value>)
  2826.                Used to set an instance variable, typically with setf.
  2827.      (send <sym> :NEW {:<ivar> <init>})
  2828.                Actually   definition  for   :ISNEW.   Creates  new   object
  2829.                initializing  instance  variables  as  specified  in keyword
  2830.                arguments,  or  to  their  default if  keyword  argument  is
  2831.                missing. Returns the object.
  2832.  
  2833. (defmethod <class> <sym> <fargs> <expr> ...)            DEFINE A NEW METHOD
  2834.      defined in class.lsp as a macro
  2835.      <class>   Class which will respond to message
  2836.      <sym>     Message name (quoted)
  2837.      <fargs>   Formal argument list. Leading "self" is implied (quoted)
  2838.      <expr>    Expressions constituting body of method (quoted)
  2839.      returns   the class object.
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.  
  2846.  
  2847. XLISP 2.1e                    OBJECT FUNCTIONS                      Page 56
  2848.  
  2849.  
  2850. (definst <class> <sym> [<args>...])            DEFINE A NEW GLOBAL INSTANCE
  2851.      defined in class.lsp as a macro
  2852.      <class>   Class of new object
  2853.      <sym>     Symbol whose value will be set to new object
  2854.      <args>    Arguments  passed  to  :NEW (typically  initial  values  for
  2855.                instance variables)
  2856.  
  2857.  
  2858.  
  2859.  
  2860.  
  2861.  
  2862.  
  2863. XLISP 2.1e                  PREDICATE FUNCTIONS                     Page 57
  2864.  
  2865.  
  2866.  
  2867. PREDICATE FUNCTIONS
  2868.  
  2869. (atom <expr>)                                              IS THIS AN ATOM?
  2870.      <expr>    the expression to check
  2871.      returns   t if the value is an atom, NIL otherwise
  2872.  
  2873. (symbolp <expr>)                                          IS THIS A SYMBOL?
  2874.      <expr>    the expression to check
  2875.      returns   t if the expression is a symbol, NIL otherwise
  2876.  
  2877. (numberp <expr>)                                          IS THIS A NUMBER?
  2878.      <expr>    the expression to check
  2879.      returns   t if the expression is a number, NIL otherwise
  2880.  
  2881. (null <expr>)                                        IS THIS AN EMPTY LIST?
  2882.      <expr>    the list to check
  2883.      returns   t if the list is empty, NIL otherwise
  2884.  
  2885. (not <expr>)                                                 IS THIS FALSE?
  2886.      <expr>    the expression to check
  2887.      return    t if the value is NIL, NIL otherwise
  2888.  
  2889. (listp <expr>)                                              IS THIS A LIST?
  2890.      <expr>    the expression to check
  2891.      returns   t if the value is a cons or NIL, NIL otherwise
  2892.  
  2893. (endp <list>)                                    IS THIS THE END OF A LIST?
  2894.      <list>    the list
  2895.      returns   t if the value is NIL, NIL otherwise
  2896.  
  2897. (consp <expr>)                                    IS THIS A NON-EMPTY LIST?
  2898.      <expr>    the expression to check
  2899.      returns   t if the value is a cons, NIL otherwise
  2900.  
  2901. (constantp <expr>)                                      IS THIS A CONSTANT?
  2902.      <expr>    the expression to check
  2903.      returns   t if the value  is a constant (basically, would  EVAL <expr>
  2904.                repeatedly return the same thing?), NIL otherwise.
  2905.  
  2906. (integerp <expr>)                                       IS THIS AN INTEGER?
  2907.      <expr>    the expression to check
  2908.      returns   t if the value is an integer, NIL otherwise
  2909.  
  2910. (floatp <expr>)                                            IS THIS A FLOAT?
  2911.      <expr>    the expression to check
  2912.      returns   t if the value is a float, NIL otherwise
  2913.  
  2914.  
  2915.  
  2916.  
  2917.  
  2918.  
  2919.  
  2920. XLISP 2.1e                  PREDICATE FUNCTIONS                     Page 58
  2921.  
  2922.  
  2923. (rationalp <expr>)                               IS THIS A RATIONAL NUMBER?
  2924.      Part of math extension.
  2925.      <expr>    the expression to check
  2926.      returns   t if the value is rational (integer or ratio), NIL otherwise
  2927.  
  2928. (complexp <expr>)                                 IS THIS A COMPLEX NUMBER?
  2929.      Part of math extension.
  2930.      <expr>    the expression to check
  2931.      returns   t if the value is a complex number, NIL otherwise
  2932.  
  2933. (stringp <expr>)                                          IS THIS A STRING?
  2934.      <expr>    the expression to check
  2935.      returns   t if the value is a string, NIL otherwise
  2936.  
  2937. (characterp <expr>)                                    IS THIS A CHARACTER?
  2938.      <expr>    the expression to check
  2939.      returns   t if the value is a character, NIL otherwise
  2940.  
  2941. (arrayp <expr>)                                           IS THIS AN ARRAY?
  2942.      <expr>    the expression to check
  2943.      returns   t if the value is an array, NIL otherwise
  2944.  
  2945. (streamp <expr>)                                          IS THIS A STREAM?
  2946.      <expr>    the expression to check
  2947.      returns   t if the value is a stream, NIL otherwise
  2948.  
  2949. (open-stream-p <stream>)                                    IS STREAM OPEN?
  2950.      <stream>  the stream
  2951.      returns   t if the stream is open, NIL otherwise
  2952.  
  2953. (input-stream-p <stream>)                               IS STREAM READABLE?
  2954.      <stream>  the stream
  2955.      returns   t if stream is readable, NIL otherwise
  2956.  
  2957. (output-stream-p <stream>)                              IS STREAM WRITABLE?
  2958.      <stream>  the stream
  2959.      returns   t if stream is writable, NIL otherwise
  2960.  
  2961. (objectp <expr>)                                         IS THIS AN OBJECT?
  2962.      <expr>    the expression to check
  2963.      returns   t if the value is an object, NIL otherwise
  2964.  
  2965. (classp <expr>)                                     IS THIS A CLASS OBJECT?
  2966.      <expr>    the expression to check
  2967.      returns   t if the value is a class object, NIL otherwise
  2968.  
  2969. (boundp <sym>)                             IS A VALUE BOUND TO THIS SYMBOL?
  2970.      <sym>     the symbol
  2971.      returns   t if a value is bound to the symbol, NIL otherwise
  2972.  
  2973.  
  2974.  
  2975.  
  2976.  
  2977.  
  2978.  
  2979. XLISP 2.1e                  PREDICATE FUNCTIONS                     Page 59
  2980.  
  2981.  
  2982. (fboundp <sym>)                 IS A FUNCTIONAL VALUE BOUND TO THIS SYMBOL?
  2983.      <sym>     the symbol
  2984.      returns   t  if a  functional  value  is  bound  to  the  symbol,  NIL
  2985.                otherwise
  2986.  
  2987. (functionp <sym>)                                       IS THIS A FUNCTION?
  2988.      Defined in common.lsp
  2989.      <expr>    the expression to check
  2990.      returns   t if the value  is a function -- that is,  can it be applied
  2991.                to arguments. This is  true for any symbol (even  those with
  2992.                no function binding), list with car being lambda, a closure,
  2993.                or subr. Otherwise returns NIL.
  2994.  
  2995. (minusp <expr>)                                    IS THIS NUMBER NEGATIVE?
  2996.      <expr>    the number to test
  2997.      returns   t if the number is negative, NIL otherwise
  2998.  
  2999. (zerop <expr>)                                         IS THIS NUMBER ZERO?
  3000.      <expr>    the number to test
  3001.      returns   t if the number is zero, NIL otherwise
  3002.  
  3003. (plusp <expr>)                                     IS THIS NUMBER POSITIVE?
  3004.      <expr>    the number to test
  3005.      returns   t if the number is positive, NIL otherwise
  3006.  
  3007. (evenp <expr>)                                        IS THIS INTEGER EVEN?
  3008.      <expr>    the integer to test
  3009.      returns   t if the integer is even, NIL otherwise
  3010.  
  3011. (oddp <expr>)                                          IS THIS INTEGER ODD?
  3012.      <expr>    the integer to test
  3013.      returns   t if the integer is odd, NIL otherwise
  3014.  
  3015. (subsetp <list1> <list2> &key :test :test-not :key)        IS SET A SUBSET?
  3016.      <list1>   the first list
  3017.      <list2>   the second list
  3018.      :test     test function (defaults to eql)
  3019.      :test-not test function (sense inverted)
  3020.      :key      function to  apply to  test function arguments  (defaults to
  3021.                identity)
  3022.      returns   t if every element of the  first list is in the second list,
  3023.                NIL otherwise
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031. XLISP 2.1e                  PREDICATE FUNCTIONS                     Page 60
  3032.  
  3033.  
  3034. (eq <expr1> <expr2>)                             ARE THE EXPRESSIONS EQUAL?
  3035. (eql <expr1> <expr2>)
  3036. (equal <expr1> <expr2>)
  3037. (equalp <expr1> <expr2>)
  3038.      equalp defined in common.lsp
  3039.      <expr1>   the first expression
  3040.      <expr2>   the second expression
  3041.      returns   t  if  equal,  NIL  otherwise. Each  is  progressively  more
  3042.                liberal in what is "equal":
  3043.                eq: identical  pointers --  works with characters,  symbols,
  3044.                          and arbitrarily small integers
  3045.                eql: works  with all numbers,  if same  type (see also  = on
  3046.                page 47)
  3047.                equal: lists and strings
  3048.                equalp:  case insensitive characters  (and strings), numbers
  3049.                          of differing types, arrays (which can be equalp to
  3050.                          string containing same elements)
  3051.  
  3052. (typep <expr> <type>)                             IS THIS A SPECIFIED TYPE?
  3053.      <expr>    the expression to test
  3054.      <type>    the type  specifier.  Symbols can  either  be one  of  those
  3055.                listed under type-of (on page 81) or one of:
  3056.                ATOM      any atom
  3057.                NULL      NIL
  3058.                LIST      matches NIL or any cons cell
  3059.                STREAM    any stream
  3060.                NUMBER    any number type
  3061.                RATIONAL  fixnum or ratio (math extension)
  3062.                STRUCT    any structure (except hash-table)
  3063.                FUNCTION  any function, as defined by functionp (page 59)
  3064.                The specifer can  also be a form (which  can be nested). All
  3065.                form elements are quoted. Valid form cars:
  3066.                or        any of the cdr type specifiers must be true
  3067.                and       all of the cdr type specifiers must be true
  3068.                not       the single cdr type specifier must be false
  3069.                satisfies the  result of applying the cdr predicate function
  3070.                          to <expr>
  3071.                member    <expr> must be eql to one of the cdr values
  3072.                object    <expr> must  be an  object, of class  specified by
  3073.                          the  single  cdr value.  The  cdr value  can  be a
  3074.                          symbol which must evaluate to a class.
  3075.                Note that everything is  of type T,  and nothing is of  type
  3076.                NIL.
  3077.      returns   t if <expr> is of type <type>, NIL otherwise.
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085. XLISP 2.1e                   CONTROL CONSTRUCTS                     Page 61
  3086.  
  3087.  
  3088.  
  3089. CONTROL CONSTRUCTS
  3090.  
  3091. (cond <pair>...)                                     EVALUATE CONDITIONALLY
  3092.      fsubr
  3093.      <pair>    pair consisting of:
  3094.                (<pred> <expr>...)
  3095.                where
  3096.                <pred>    is a predicate expression
  3097.                <expr>    evaluated if the predicate is not NIL
  3098.      returns   the value of the first expression whose predicate is not NIL
  3099.  
  3100. (and <expr>...)                    THE LOGICAL AND OF A LIST OF EXPRESSIONS
  3101.      fsubr
  3102.      <expr>    the expressions to be ANDed
  3103.      returns   NIL if any expression evaluates to NIL, otherwise the  value
  3104.                of  the  last  expression (evaluation  of  expressions stops
  3105.                after the first expression that evaluates to NIL)
  3106.  
  3107. (or <expr>...)                      THE LOGICAL OR OF A LIST OF EXPRESSIONS
  3108.      fsubr
  3109.      <expr>    the expressions to be ORed
  3110.      returns   NIL if all expressions evaluate  to NIL, otherwise the value
  3111.                of the first non-NIL  expression (evaluation of  expressions
  3112.                stops after  the first expression that does  not evaluate to
  3113.                NIL)
  3114.  
  3115. (if <texpr> <expr1> [<expr2>])           EVALUATE EXPRESSIONS CONDITIONALLY
  3116.      fsubr
  3117.      <texpr>   the test expression
  3118.      <expr1>   the expression to be evaluated if texpr is non-NIL
  3119.      <expr2>   the expression to be evaluated if texpr is NIL
  3120.      returns   the value of the selected expression
  3121.  
  3122. (when <texpr> <expr>...)             EVALUATE ONLY WHEN A CONDITION IS TRUE
  3123.      fsubr
  3124.      <texpr>   the test expression
  3125.      <expr>    the expression(s) to be evaluted if texpr is non-NIL
  3126.      returns   the value of the last expression or NIL
  3127.  
  3128. (unless <texpr> <expr>...)          EVALUATE ONLY WHEN A CONDITION IS FALSE
  3129.      fsubr
  3130.      <texpr>   the test expression
  3131.      <expr>    the expression(s) to be evaluated if texpr is NIL
  3132.      returns   the value of the last expression or NIL
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140. XLISP 2.1e                   CONTROL CONSTRUCTS                     Page 62
  3141.  
  3142.  
  3143. (case <expr> <case>...[(t <expr>)])                          SELECT BY CASE
  3144.      fsubr
  3145.      <expr>    the selection expression
  3146.      <case>    pair consisting of:
  3147.                (<value> <expr>...)
  3148.                where:
  3149.                <value>   is a  single expression  or a list  of expressions
  3150.                          (unevaluated)
  3151.                <expr>    are expressions to execute if the case matches
  3152.      (t <expr>)          default case (no previous matching)
  3153.      returns   the value of the last expression of the matching case
  3154.  
  3155. (let (<binding>...) <expr>...)                        CREATE LOCAL BINDINGS
  3156. (let* (<binding>...) <expr>...)                 LET WITH SEQUENTIAL BINDING
  3157.      fsubr
  3158.      <binding> the variable bindings each of which is either:
  3159.                1)        a symbol (which is initialized to NIL)
  3160.                2)        a list whose car is a symbol  and whose cadr is an
  3161.                          initialization expression
  3162.      <expr>    the expressions to be evaluated
  3163.      returns   the value of the last expression
  3164.  
  3165. (flet (<binding>...) <expr>...)                      CREATE LOCAL FUNCTIONS
  3166. (labels (<binding>...) <expr>...)             FLET WITH RECURSIVE FUNCTIONS
  3167. (macrolet (<binding>...) <expr>...)                     CREATE LOCAL MACROS
  3168.      fsubr
  3169.      <binding> the function bindings each of which is:
  3170.                (<sym> <fargs> <expr>...)
  3171.                where:
  3172.                <sym>     the function/macro name
  3173.                <fargs>   formal argument list (lambda list)
  3174.                <expr>    expressions   constituting   the   body   of   the
  3175.                          function/macro
  3176.      <expr>    the expressions to be evaluated
  3177.      returns   the value of the last expression
  3178.  
  3179. (catch <sym> <expr>...)               EVALUATE EXPRESSIONS AND CATCH THROWS
  3180.      fsubr
  3181.      <sym>     the catch tag
  3182.      <expr>    expressions to evaluate
  3183.      returns   the value of the last expression the throw expression
  3184.  
  3185. (throw <sym> [<expr>])                                     THROW TO A CATCH
  3186.      fsubr
  3187.      <sym>     the catch tag
  3188.      <expr>    the value for the catch to return (defaults to NIL)
  3189.      returns   never returns
  3190.  
  3191.  
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197. XLISP 2.1e                   CONTROL CONSTRUCTS                     Page 63
  3198.  
  3199.  
  3200. (unwind-protect <expr> <cexpr>...)      PROTECT EVALUATION OF AN EXPRESSION
  3201.      fsubr
  3202.      <expr>    the expression to protect
  3203.      <cexpr>   the cleanup expressions
  3204.      returns   the value of the expression
  3205.      Note:   unwind-protect guarantees  to execute the  cleanup expressions
  3206.      even  if a non-local exit  terminates the evaluation  of the protected
  3207.      expression
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215. XLISP 2.1e                   LOOPING CONSTRUCTS                     Page 64
  3216.  
  3217.  
  3218.  
  3219. LOOPING CONSTRUCTS
  3220.  
  3221. (loop <expr>...)                                         BASIC LOOPING FORM
  3222.      fsubr
  3223.      <expr>    the body of the loop
  3224.      returns   never returns (must use non-local exit, such as RETURN)
  3225.  
  3226. (do (<binding>...) (<texpr> <rexpr>...) <expr>...)     GENERAL LOOPING FORM
  3227. (do* (<binding>...) (<texpr> <rexpr>...) <expr>...)
  3228.      fsubr. do binds simultaneously, do* binds sequentially
  3229.      <binding> the variable bindings each of which is either:
  3230.                1)        a symbol (which is initialized to NIL)
  3231.                2)        a list of the form: (<sym> <init> [<step>])
  3232.                where:
  3233.                          <sym>     is the symbol to bind
  3234.                          <init>    the initial value of the symbol
  3235.                          <step>    a step expression
  3236.      <texpr>   the termination test expression
  3237.      <rexpr>   result expressions (the default is NIL)
  3238.      <expr>    the body of the loop (treated like an implicit prog)
  3239.      returns   the value of the last result expression
  3240.  
  3241. (dolist (<sym> <expr> [<rexpr>]) <expr>...)             LOOP THROUGH A LIST
  3242.      fsubr
  3243.      <sym>     the symbol to bind to each list element
  3244.      <expr>    the list expression
  3245.      <rexpr>   the result expression (the default is NIL)
  3246.      <expr>    the body of the loop (treated like an implicit prog)
  3247.      returns   the result expression
  3248.  
  3249. (dotimes (<sym> <expr> [<rexpr>]) <expr>...)          LOOP FROM ZERO TO N-1
  3250.      fsubr
  3251.      <sym>     the symbol to bind to each value from 0 to n-1
  3252.      <expr>    the number of times to loop
  3253.      <rexpr>   the result expression (the default is NIL)
  3254.      <expr>    the body of the loop (treated like an implicit prog)
  3255.      returns   the result expression
  3256.  
  3257.  
  3258.  
  3259.  
  3260.  
  3261.  
  3262.  
  3263. XLISP 2.1e                  THE PROGRAM FEATURE                     Page 65
  3264.  
  3265.  
  3266.  
  3267. THE PROGRAM FEATURE
  3268.  
  3269. (prog (<binding>...) <expr>...)                         THE PROGRAM FEATURE
  3270. (prog* (<binding>...) <expr>...)               PROG WITH SEQUENTIAL BINDING
  3271.      fsubr -- equivalent to (let () (block NIL (tagbody ...)))
  3272.      <binding> the variable bindings each of which is either:
  3273.                1)        a symbol (which is initialized to NIL)
  3274.                2)        a list whose car is a symbol and whose cadr is  an
  3275.                          initialization expression
  3276.      <expr>    expressions to evaluate or tags (symbols)
  3277.      returns   NIL or the argument passed to the return function
  3278.  
  3279. (block <name> <expr>...)                                        NAMED BLOCK
  3280.      fsubr
  3281.      <name>    the block name (quoted symbol)
  3282.      <expr>    the block body
  3283.      returns   the value of the last expression
  3284.  
  3285. (return [<expr>])                  CAUSE A PROG CONSTRUCT TO RETURN A VALUE
  3286.      fsubr
  3287.      <expr>    the value (defaults to NIL)
  3288.      returns   never returns
  3289.  
  3290. (return-from <name> [<value>])        RETURN FROM A NAMED BLOCK OR FUNCTION
  3291.      fsubr. In xlisp, the names are dynamically scoped.
  3292.      <name>    the  block or function name (quoted symbol). If name is NIL,
  3293.                use function RETURN.
  3294.      <value>   the value to return (defaults to NIL)
  3295.      returns   never returns
  3296.  
  3297. (tagbody <expr>...)                                       BLOCK WITH LABELS
  3298.      fsubr
  3299.      <expr>    expression(s) to evaluate or tags (symbols)
  3300.      returns   NIL
  3301.  
  3302. (go <sym>)                                     GO TO A TAG WITHIN A TAGBODY
  3303.      fsubr. In xlisp, tags are dynamically scoped.
  3304.      <sym>     the tag (quoted)
  3305.      returns   never returns
  3306.  
  3307. (progv <slist> <vlist> <expr>...)                  DYNAMICALLY BIND SYMBOLS
  3308.      fsubr
  3309.      <slist>   list of symbols (evaluated)
  3310.      <vlist>   list of values to bind to the symbols (evaluated)
  3311.      <expr>    expression(s) to evaluate
  3312.      returns   the value of the last expression
  3313.  
  3314.  
  3315.  
  3316.  
  3317.  
  3318.  
  3319.  
  3320. XLISP 2.1e                  THE PROGRAM FEATURE                     Page 66
  3321.  
  3322.  
  3323. (prog1 <expr1> <expr>...)                  EXECUTE EXPRESSIONS SEQUENTIALLY
  3324.      fsubr
  3325.      <expr1>   the first expression to evaluate
  3326.      <expr>    the remaining expressions to evaluate
  3327.      returns   the value of the first expression
  3328.  
  3329. (prog2 <expr1> <expr2> <expr>...)          EXECUTE EXPRESSIONS SEQUENTIALLY
  3330.      fsubr
  3331.      <expr1>   the first expression to evaluate
  3332.      <expr2>   the second expression to evaluate
  3333.      <expr>    the remaining expressions to evaluate
  3334.      returns   the value of the second expression
  3335.  
  3336. (progn <expr>...)                          EXECUTE EXPRESSIONS SEQUENTIALLY
  3337.      fsubr
  3338.      <expr>    the expressions to evaluate
  3339.      returns   the value of the last expression (or NIL)
  3340.  
  3341.  
  3342.  
  3343.  
  3344.  
  3345.  
  3346.  
  3347. XLISP 2.1e                 INPUT/OUTPUT FUNCTIONS                   Page 67
  3348.  
  3349.  
  3350.  
  3351. INPUT/OUTPUT FUNCTIONS
  3352.  
  3353. Note  that when printing objects,  printing is accomplished  by sending the
  3354. message :prin1 to the object.
  3355.  
  3356. (read [<stream> [<eof> [<rflag>]]])                      READ AN EXPRESSION
  3357.      <stream>  the input stream (default, or NIL, is *standard-input*, T is
  3358.                *terminal-io*)
  3359.      <eof>     the value to return on end of file (default is NIL)
  3360.      <rflag>   recursive read flag. The value is ignored
  3361.      returns   the expression read
  3362.  
  3363. (set-macro-character <ch> <fcn> [ T ])                    MODIFY READ TABLE
  3364.      defined in init.lsp
  3365.      <ch>      character to define
  3366.      <fcn>     function to bind to character (see page 12)
  3367.      T         if TMACRO rather than NMACRO
  3368.  
  3369. (get-macro-character <ch>)                               EXAMINE READ TABLE
  3370.      defined in init.lsp
  3371.      <ch>      character
  3372.      returns   function bound to character
  3373.  
  3374. (print <expr> [<stream>])                 PRINT AN EXPRESSION ON A NEW LINE
  3375.      The expression is printed using prin1, then current line is terminated
  3376.      (Note: this is backwards from Common Lisp).
  3377.      <expr>    the expression to be printed
  3378.      <stream>  the output stream (default,  or NIL, is *standard-output*, T
  3379.                is *terminal-io*)
  3380.      returns   the expression
  3381.  
  3382. (prin1 <expr> [<stream>])                               PRINT AN EXPRESSION
  3383.      symbols, cons cells (without circularities), arrays, strings, numbers,
  3384.      and characters are  printed in  a format generally  acceptable to  the
  3385.      read  function.  Printing  format  can   be  affected  by  the  global
  3386.      formatting variables: *print-level*  and *print-length* for lists  and
  3387.      arrays,  *integer-format*  for  fixnums, *float-format*  for  flonums,
  3388.      *ratio-format*  for ratios, and  *print-case* and *readtable-case* for
  3389.      symbols.
  3390.      <expr>    the expression to be printed
  3391.      <stream>  the output stream (default,  or NIL, is *standard-output*, T
  3392.                is *terminal-io*)
  3393.      returns   the expression
  3394.  
  3395.  
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401. XLISP 2.1e                 INPUT/OUTPUT FUNCTIONS                   Page 68
  3402.  
  3403.  
  3404. (princ <expr> [<stream>])               PRINT AN EXPRESSION WITHOUT QUOTING
  3405.      Like  PRIN1  except  symbols  (including   uninterned),  strings,  and
  3406.      characters are printed without using any quoting mechanisms.
  3407.      <expr>    the expressions to be printed
  3408.      <stream>  the output stream (default,  or NIL, is *standard-output*, T
  3409.                is *terminal-io*)
  3410.      returns   the expression
  3411.  
  3412. (pprint <expr> [<stream>])                       PRETTY PRINT AN EXPRESSION
  3413.      Uses prin1 for printing.
  3414.      <expr>    the expressions to be printed
  3415.      <stream>  the output stream (default,  or NIL, is *standard-output*, T
  3416.                is *terminal-io*)
  3417.      returns   the expression
  3418.  
  3419. (terpri [<stream>])                        TERMINATE THE CURRENT PRINT LINE
  3420.      <stream>  the output stream (default,  or NIL, is *standard-output*, T
  3421.                is *terminal-io*)
  3422.      returns   NIL
  3423.  
  3424. (fresh-line [<stream>])                                    START A NEW LINE
  3425.      <stream>  the output stream (default,  or NIL, is *standard-output*, T
  3426.                is *terminal-io*)
  3427.      returns   t if a new  list was started, NIL if already at the start of
  3428.                a line.
  3429.  
  3430. (flatsize <expr>)              LENGTH OF PRINTED REPRESENTATION USING PRIN1
  3431.      <expr>    the expression
  3432.      returns   the length
  3433.  
  3434. (flatc <expr>)                 LENGTH OF PRINTED REPRESENTATION USING PRINC
  3435.      <expr>    the expression
  3436.      returns   the length
  3437.  
  3438. (y-or-n-p [<fmt> [<arg>...]])                      ASK A YES OR NO QUESTION
  3439.      defined in common.lsp. Uses *terminal-io* stream for interaction.
  3440.      <fmt>     optional format string for question (see page 69)
  3441.      <arg>     arguments, if any, for format string
  3442.      returns   T for yes, NIL for no.
  3443.  
  3444.  
  3445.  
  3446.  
  3447.  
  3448.  
  3449.  
  3450. XLISP 2.1e                  THE FORMAT FUNCTION                     Page 69
  3451.  
  3452.  
  3453.  
  3454. THE FORMAT FUNCTION
  3455.  
  3456. (format <stream> <fmt> [<arg>...])                      DO FORMATTED OUTPUT
  3457.      <stream>  the output stream (T is *standard-output*)
  3458.      <fmt>     the format string
  3459.      <arg>     the format arguments
  3460.      returns   output string if <stream> is NIL, NIL otherwise
  3461.  
  3462. The format  string can contain characters that should be copied directly to
  3463. the output and formatting directives. The formatting directives are:
  3464.  
  3465.      ~A or ~a  print next argument using princ
  3466.      ~S or ~s  print next argument using prin1
  3467.      ~D or ~d  print next argument integer
  3468.      ~E or ~e  print next argument in exponential form
  3469.      ~F or ~f  print next argument in fixed point form
  3470.      ~G or ~g  print  next argument  using  either ~E  or  ~F depending  on
  3471.      magnitude
  3472.      ~%        start a new line
  3473.      ~&        start a new line if not on a new line
  3474.      ~t or ~T  go to a specified column
  3475.      ~~        print a tilde character
  3476.      ~\n       ignore return and following whitespace
  3477.  
  3478. The format directives can contain optional prefix and optional colon (:) or
  3479. at-sign (@)  modifiers between  the tilde  and directive  character. Prefix
  3480. characters  are unsigned  integers, or  the character  'v' to  indicate the
  3481. number is taken from the next argument, or a single quote (') followed by a
  3482. single character for those parameters that should be a single character.
  3483.  
  3484. For ~A and ~S the full form is:
  3485.  
  3486.      ~mincol,colinc,minpad,padchar:@A        (or S)
  3487.  
  3488. If : is  given, NIL will  print as "()"  rather than  "NIL". The string  is
  3489. padded  on the right (or left, if @ is given) with at least "minpad" copies
  3490. of the "padchar". Padding characters are then inserted  "colinc" characters
  3491. at a time until the  total width is at  least "mincol". The defaults are  0
  3492. for mincol and minpad, 1 for colinc, and #\space for padchar. For example:
  3493.  
  3494.      ~15,,2,'.@A
  3495.  
  3496. The output is padded on  the left with at least 2 periods  until the output
  3497. is at least 15 characters wide.
  3498.  
  3499. For ~D the full form is:
  3500.  
  3501.      ~mincol,padchar@D
  3502.  
  3503.  
  3504.  
  3505.  
  3506.  
  3507.  
  3508.  
  3509. XLISP 2.1e                  THE FORMAT FUNCTION                     Page 70
  3510.  
  3511.  
  3512. If the  argument is not  a FIXNUM, then the  format "~mincolA" is  used. If
  3513. "mincol"  is specified then the number is padded on the left to be at least
  3514. that many characters  long using "padchar". "padchar" defaults  to #\space.
  3515. If @ is used and the value is positive, then a leading plus sign is printed
  3516. before the first digit.
  3517.  
  3518. For ~E ~F and ~G the full form is:
  3519.  
  3520.      ~mincol,round,padchar@E                 (or F or G)
  3521.  
  3522. (This implementation is not Common Lisp compatible.) If the argument is not
  3523. a   real   number   (FIXNUM,   RATIO,   or   FLONUM),   then   the   format
  3524. "~mincol,padcharD" is used. The number  is printed using the C language  e,
  3525. f, or g formats. If the number  could potentially take more than 100 digits
  3526. to print,  then F format is forced  to E format, although  some C libraries
  3527. will  do this at a  lower number of  digits. If "round"  is specified, than
  3528. that is the number of digits to the right of the decimal point that will be
  3529. printed, otherwise six  digits (or whatever is  necessary in G format)  are
  3530. printed.  In G format, trailing zeroes are deleted and exponential notation
  3531. is used if the exponent of the number is greater than the precision or less
  3532. than -4. If the  @ modifier is used, a leading plus  sign is printed before
  3533. positive values. If "mincol" is specified, the number is padded on the left
  3534. to be at least "mincol" characters long using "padchar". "padchar" defaults
  3535. to #\space.
  3536.  
  3537. For ~% and  ~~, the full form is ~n% or  ~n~. "n" copies (default=1) of the
  3538. character are output.
  3539.  
  3540. For ~&, the full form is  ~n&. ~0& does nothing. Otherwise enough new  line
  3541. characters are emited to move down to the "n"th new line (default=1).
  3542.  
  3543. For ~T, the full form is:
  3544.  
  3545.      ~count,tabwidth@T
  3546.  
  3547. The cursor  is  moved to  column  "count" (default  1).  If the  cursor  is
  3548. initially at count or  beyond, then the cursor is moved forward to the next
  3549. position that is a multiple of "tabwidth" (default 1) columns beyond count.
  3550. When the @  modifier is used, then positioning is  relative. "count" spaces
  3551. are printed, then additional  spaces are printed to make the  column number
  3552. be a multiple of "tabwidth". Note that column calcuations will be incorrect
  3553. if ASCII tab characters or ANSI cursor positioning sequences are used.
  3554.  
  3555. For  ~\n, if  the colon  modifier  is used,  then the  format directive  is
  3556. ignored (allowing embedded returns in the source for enhanced readability).
  3557. If the at-sign  modifier is used,  then a carriage  return is emitted,  and
  3558. following whitespace is ignored. 
  3559.  
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566. XLISP 2.1e                   FILE I/O FUNCTIONS                     Page 71
  3567.  
  3568.  
  3569.  
  3570. FILE I/O FUNCTIONS
  3571.  
  3572. Note  that initially, when starting XLISP-PLUS, there are six system stream
  3573. symbols which are associated with three streams. *TERMINAL-IO* is a special
  3574. stream  that  is  bound  to  the  keyboard  and  display,  and  allows  for
  3575. interactive editing.  *STANDARD-INPUT* is  bound  to standard  input or  to
  3576. *TERMINAL-IO*  if not  redirected. *STANDARD-OUTPUT*  is bound  to standard
  3577. output or to *TERMINAL-IO* if not redirected. *ERROR-OUTPUT* (error message
  3578. output),  *TRACE-OUTPUT* (for  TRACE  and TIME  functions), and  *DEBUG-IO*
  3579. (break loop i/o,  and messages)  are all bound  to *TERMINAL-IO*.  Standard
  3580. input and output can be redirected on most systems.
  3581.  
  3582. File streams  are printed using  the #< format that  cannot be read  by the
  3583. reader.  Console, standard input,  standard output, and  closed streams are
  3584. explicitly indicated.  Other file streams will typically  indicate the name
  3585. of the attached file.
  3586.  
  3587. When the transcript is active (either -t on the command line or the DRIBBLE
  3588. function),  all  characters  that   would  be  sent  to  the   display  via
  3589. *TERMINAL-IO* are also placed in the transcript file.
  3590.  
  3591. *TERMINAL-IO*  should not  be changed.  Any other  system streams  that are
  3592. changed by an application should be restored to their original values.
  3593.  
  3594. (read-char [<stream>])                       READ A CHARACTER FROM A STREAM
  3595.      <stream>  the input stream (default, or NIL, is *standard-input*, T is
  3596.                *terminal-io*)
  3597.      returns   the character or NIL at end of file
  3598.  
  3599. (peek-char [<flag> [<stream>]])                  PEEK AT THE NEXT CHARACTER
  3600.      <flag>    flag for skipping white space (default is NIL)
  3601.      <stream>  the input stream (default, or NIL, is *standard-input*, T is
  3602.                *terminal-io*)
  3603.      returns   the character or NIL at end of file
  3604.  
  3605. (write-char <ch> [<stream>])                  WRITE A CHARACTER TO A STREAM
  3606.      <ch>      the character to write
  3607.      <stream>  the output stream (default,  or NIL, is *standard-output*, T
  3608.                is *terminal-io*)
  3609.      returns   the character
  3610.  
  3611. (read-line [<stream>])                            READ A LINE FROM A STREAM
  3612.      <stream>  the input stream (default, or NIL, is *standard-input*, T is
  3613.                *terminal-io*)
  3614.      returns   the string excluding the #\newline, or NIL at end of file
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622. XLISP 2.1e                   FILE I/O FUNCTIONS                     Page 72
  3623.  
  3624.  
  3625. (open <fname> &key :direction :element-type :if-exists :if-does-not-exist)
  3626.                                                          OPEN A FILE STREAM
  3627.      The function OPEN has been significantly enhanced over original XLISP.
  3628.      The original function  only had the :direction keyword argument, which
  3629.      could only  have the  values :input  or :output.  When  used with  the
  3630.      :output keyword, it was equivalent to (open <fname> :direction :output
  3631.      :if-exists :supersede). A maximum of ten files can be open  at any one
  3632.      time, including any files open via the LOAD, DRIBBLE, SAVE and RESTORE
  3633.      commands. The open command  may force a garbage collection  to reclaim
  3634.      file slots used by unbound file streams.
  3635.  
  3636.      <fname>        the file  name string,  symbol, or file  stream created
  3637.                     via OPEN. In the last case, the name is used  to open a
  3638.                     second  stream  on the  same  file  -- this  can  cause
  3639.                     problems if one or more streams is used for writing.
  3640.      :direction     Read  and  write  permission  for  stream  (default  is
  3641.                     :input).
  3642.        :input       Open file for read operations only.
  3643.        :probe       Open file for reading,  then close it (use to  test for
  3644.                     file existance)
  3645.        :output      Open file for write operations only.
  3646.        :io          Like :output, but reading also allowed.
  3647.      :element-type  FIXNUM or CHARACTER (default is CHARACTER), as returned
  3648.                     by  type-of function  (on page  81). Files  opened with
  3649.                     type FIXNUM  are binary  files instead of  ascii, which
  3650.                     means no  crlf to/from  lf conversion takes  place, and
  3651.                     control-Z will not  terminate an input file.  It is the
  3652.                     intent  of  Common  Lisp  that  binary  files  only  be
  3653.                     accessed  with  read-byte  and write-byte  while  ascii
  3654.                     files be  accessed with any function  but read-byte and
  3655.                     write-byte. XLISP does not enforce that distinction.
  3656.      :if-exists     action  to take  if file  exists. Argument  ignored for
  3657.                     :input (file is positioned at start) or :probe (file is
  3658.                     closed)
  3659.        :error       give error message
  3660.        :rename      rename file to  generated backup name, then  open a new
  3661.                     file of the original name. This is the default action
  3662.        :new-version same as :rename
  3663.        :overwrite   file is positioned to start, original data intact
  3664.        :append      file is positioned to end
  3665.        :supersede   delete original file and open new file of the same name
  3666.        :rename-and-delete  same as :supersede
  3667.        NIL          close file and return NIL
  3668.      :if-does-not-exist    action to take if file does not exist.
  3669.        :error       give error message (default  for :input, or  :overwrite
  3670.                     or :append)
  3671.        :create      create  a new file (default for :output or :io when not
  3672.                     :overwrite or :append)
  3673.        NIL          return NIL (default for :probe)
  3674.      returns        a file stream, or sometimes NIL
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682. XLISP 2.1e                   FILE I/O FUNCTIONS                     Page 73
  3683.  
  3684.  
  3685. (close <stream>)                                        CLOSE A FILE STREAM
  3686.      The stream becomes a  "closed stream." Note that unbound  file streams
  3687.      are closed automatically during a garbage collection.
  3688.      <stream>  the stream, which may be a string stream
  3689.      returns   t  if stream closed, NIL  if terminal (cannot  be closed) or
  3690.                already closed.
  3691.  
  3692. (delete-file <fname>)                                         DELETE A FILE
  3693.      <fname>   file name string, symbol or a stream opened with OPEN
  3694.      returns   t  if file  does not exist  or is  deleted. If  <fname> is a
  3695.                stream,  the stream is closed before the file is deleted. An
  3696.                error occurs if the file cannot be deleted.
  3697.  
  3698. (truename <fname>)                                OBTAIN THE FILE PATH NAME
  3699.      <fname>   file name string, symbol, or a stream opened with OPEN
  3700.      returns   string  representing the  true file  name (absolute  path to
  3701.      file).
  3702.  
  3703. (with-open-file (<var> <fname> [<karg>...]) [<expr>...])
  3704.                                                       EVALUATE USING A FILE
  3705.      Defined in  common.lsp as  a macro.  File will always  be closed  upon
  3706.      completion
  3707.      <var>     symbol name to bind  stream to while evaluating expresssions
  3708.                (quoted)
  3709.      <fname>   file name string or symbol
  3710.      <karg>    keyword arguments for the implicit open command
  3711.      <expr>    expressions to evaluate while file is open (implicit progn)
  3712.      returns   value of last <expr>.
  3713.  
  3714. (read-byte [<stream>])                            READ A BYTE FROM A STREAM
  3715.      <stream>  the input stream (default, or NIL, is *standard-input*, T is
  3716.                *terminal-io*)
  3717.      returns   the byte (integer) or NIL at end of file
  3718.  
  3719. (write-byte <byte> [<stream>])                     WRITE A BYTE TO A STREAM
  3720.      <byte>    the byte to write (integer)
  3721.      <stream>  the output stream (default,  or NIL, is *standard-output*, T
  3722.                is *terminal-io*)
  3723.      returns   the byte (integer)
  3724.  
  3725. (file-length <stream>)                                   GET LENGTH OF FILE
  3726.      For an ascii file, the  length reported may be larger than  the number
  3727.      of characters read or written because of CR conversion.
  3728.      <stream>  the file stream (should be disk file)
  3729.      returns   length of file, or NIL if cannot be determined.
  3730.  
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.  
  3737. XLISP 2.1e                   FILE I/O FUNCTIONS                     Page 74
  3738.  
  3739.  
  3740. (file-position <stream> [<expr>])                  GET OR SET FILE POSITION
  3741.      For an ascii file, the file position may not be the same as the number
  3742.      of characters read  or written because  of CR conversion.  It will  be
  3743.      correct  when using  file-position to  position a  file at  a location
  3744.      earlier reported by file-position.
  3745.      <stream>  the file stream (should be a disk file)
  3746.      <expr>    desired  file position,  if  setting position.  Can also  be
  3747.                :start for start of file or :end for end of file.
  3748.      returns   if  setting position,  and  successful, then  T; if  getting
  3749.                position and successful then the position; otherwise NIL
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757. XLISP 2.1e                STRING STREAM FUNCTIONS                   Page 75
  3758.  
  3759.  
  3760.  
  3761. STRING STREAM FUNCTIONS
  3762.  
  3763. These functions  operate  on  unnamed streams.  An  unnamed  output  stream
  3764. collects characters sent to  it when it is used  as the destination of  any
  3765. output function. The functions 'get-output-stream' string and list return a
  3766. sting or list of the characters.
  3767.  
  3768. An  unnamed  input  stream  is setup  with  the  'make-string-input-stream'
  3769. function and returns  each character of the string  when it is used  as the
  3770. source of any input function.
  3771.  
  3772. Note that there is no difference between unnamed  input and output streams.
  3773. Unnamed input streams may be written  to by output functions, in which case
  3774. the characters are appended to  the tail end of the stream.  Unnamed output
  3775. streams  may also be (destructively) read by  any input function as well as
  3776. the get-output-stream functions.
  3777.  
  3778. (make-string-input-stream <str> [<start> [<end>]])
  3779.      <str>     the string
  3780.      <start>   the starting offset
  3781.      <end>     the ending offset + 1 or NIL for end of string
  3782.      returns   an unnamed stream that reads from the string
  3783.  
  3784. (make-string-output-stream)
  3785.      returns   an unnamed output stream
  3786.  
  3787. (get-output-stream-string <stream>)
  3788.      The output stream is emptied by this function
  3789.      <stream>  the output stream
  3790.      returns   the output so far as a string
  3791.  
  3792. (get-output-stream-list <stream>)
  3793.      The output stream is emptied by this function
  3794.      <stream>  the output stream
  3795.      returns   the output so far as a list
  3796.  
  3797. (with-input-from-string (<var> <str> &key :start :end :index) [<expr>...])
  3798.      Defined in common.lsp as a macro
  3799.      <var>     symbol  that   stream  is  bound  to   during  execution  of
  3800.                expressions (quoted)
  3801.      <str>     the string
  3802.      :start    starting offset into string (default 0)
  3803.      :end      ending offset + 1  (default, or NIL, is end of string)
  3804.      :index    setf place  form which  gets final  index into  string after
  3805.                last expression is executed (quoted)
  3806.      <expr>    expressions to evaluate (implicit progn)
  3807.      returns   the value of the last <expr>
  3808.  
  3809.  
  3810.  
  3811.  
  3812.  
  3813.  
  3814.  
  3815. XLISP 2.1e                STRING STREAM FUNCTIONS                   Page 76
  3816.  
  3817.  
  3818. (with-output-to-string (<var>) [<expr>...])
  3819.      Defined in common.lsp as a macro
  3820.      <var>     symbol  that   stream  is  bound  to   during  execution  of
  3821.                expressions (quoted)
  3822.      <expr>    expressions to evaluate (implicit progn)
  3823.      returns   contents of stream, as a string
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831. XLISP 2.1e              DEBUGGING AND ERROR HANDLING                Page 77
  3832.  
  3833.  
  3834.  
  3835. DEBUGGING AND ERROR HANDLING FUNCTIONS
  3836.  
  3837. (trace [<sym>...])                         ADD A FUNCTION TO THE TRACE LIST
  3838.      fsubr
  3839.      <sym>     the function(s) to add (quoted)
  3840.      returns   the trace list
  3841.  
  3842. (untrace [<sym>...])                  REMOVE A FUNCTION FROM THE TRACE LIST
  3843.      fsubr. If no functions given, all functions are removed from the trace
  3844.      list.
  3845.      <sym>     the function(s) to remove (quoted)
  3846.      returns   the trace list
  3847.  
  3848. (error <emsg> [<arg>])                       SIGNAL A NON-CORRECTABLE ERROR
  3849.      <emsg>    the error message string
  3850.      <arg>     the argument expression (printed after the message)
  3851.      returns   never returns
  3852.  
  3853. (cerror <cmsg> <emsg> [<arg>])                   SIGNAL A CORRECTABLE ERROR
  3854.      <cmsg>    the continue message string
  3855.      <emsg>    the error message string
  3856.      <arg>     the argument expression (printed after the message)
  3857.      returns   NIL when continued from the break loop
  3858.  
  3859. (break [<bmsg> [<arg>]])                                 ENTER A BREAK LOOP
  3860.      <bmsg>    the break message string (defaults to "**BREAK**")
  3861.      <arg>     the argument expression (printed after the message)
  3862.      returns   NIL when continued from the break loop
  3863.  
  3864. (clean-up)                                          CLEAN-UP AFTER AN ERROR
  3865.      returns   never returns
  3866.  
  3867. (top-level)             CLEAN-UP AFTER AN ERROR AND RETURN TO THE TOP LEVEL
  3868.      returns   never returns
  3869.  
  3870. (continue)                                CONTINUE FROM A CORRECTABLE ERROR
  3871.      returns   never returns
  3872.  
  3873. (errset <expr> [<pflag>])                                       TRAP ERRORS
  3874.      fsubr
  3875.      <expr>    the expression to execute
  3876.      <pflag>   flag to control printing of the error message (default t)
  3877.      returns   the  value of the last expression consed  with NIL or NIL on
  3878.                error
  3879.  
  3880. (baktrace [<n>])                   PRINT N LEVELS OF TRACE BACK INFORMATION
  3881.      <n>       the number of levels (defaults to all levels)
  3882.      returns   NIL
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890. XLISP 2.1e              DEBUGGING AND ERROR HANDLING                Page 78
  3891.  
  3892.  
  3893. (evalhook <expr> <ehook> <ahook> [<env>])               EVALUATE WITH HOOKS
  3894.      <expr>    the expression to evaluate.  <ehook> is not used at  the top
  3895.                level.
  3896.      <ehook>   the value for *evalhook*
  3897.      <ahook>   the value for *applyhook*
  3898.      <env>     the  environment (default is  NIL). The  format is  a dotted
  3899.                pair of  value (car) and function (cdr)  binding lists. Each
  3900.                binding  list is a list  of level binding  a-lists, with the
  3901.                innermost a-list first. The level  binding a-list associates
  3902.                the bound symbol with its value.
  3903.      returns   the result of evaluating the expression
  3904.  
  3905. (applyhook <fun> <arglist> <ehook> <ahook>)                APPLY WITH HOOKS
  3906.      <fun>     The function closure. <ahook> is  not used for this function
  3907.                application.
  3908.      <arglist> The list of arguments.
  3909.      <ehook>   the value for *evalhook*
  3910.      <ahook>   the value for *applyhook*
  3911.      returns   the result of applying <fun> to <arglist>
  3912.  
  3913. (debug)                                                 ENABLE DEBUG BREAKS
  3914. (nodebug)                                              DISABLE DEBUG BREAKS
  3915.      Defined in init.lsp
  3916.  
  3917.  
  3918.  
  3919.  
  3920.  
  3921.  
  3922.  
  3923. XLISP 2.1e                    SYSTEM FUNCTIONS                      Page 79
  3924.  
  3925.  
  3926.  
  3927. SYSTEM FUNCTIONS
  3928.  
  3929. (load <fname> &key :verbose :print)                      LOAD A SOURCE FILE
  3930.      An implicit  ERRSET exists  in this function  so that if  error occurs
  3931.      during  loading, and *breakenable* is NIL, then the error message will
  3932.      be printed and  NIL will  be returned. The  OS environmental  variable
  3933.      XLPATH is used as  a search path  for files in  this function. If  the
  3934.      filename  does not contain path  separators ('/' for  UNIX, and either
  3935.      '/' or  '\' for MS-DOS) and  XLPATH is defined, then  each pathname in
  3936.      XLPATH is tried in turn until a matching file  is found. If no file is
  3937.      found, then  one last attempt  is made  in the current  directory. The
  3938.      pathnames are separated by either a space or semicolon, and a trailing
  3939.      path separator character is optional.
  3940.      <fname>   the filename string, symbol, or  a file stream created  with
  3941.                OPEN. The extension "lsp" is assumed.
  3942.      :verbose  the verbose flag (default is t)
  3943.      :print    the print flag (default is NIL)
  3944.      returns   t if successful, else NIL
  3945.  
  3946. (restore <fname>)                             RESTORE WORKSPACE FROM A FILE
  3947.      The OS  environmental variable  XLPATH is  used as  a search path  for
  3948.      files in this function. See the note under function "load", above. The
  3949.      standard  system streams  are  restored to  the  defaults as  of  when
  3950.      XLISP-PLUS  was started. Files streams  are restored in  the same mode
  3951.      they  were created, if possible, and are positioned where they were at
  3952.      the time of  the save. If the  files have been altered  or moved since
  3953.      the time of  the save, the restore will not  be completely successful.
  3954.      Memory allocation will  not be  the same  as the  current settings  of
  3955.      ALLOC are  used. Execution  proceeds at the  top-level read-eval-print
  3956.      loop. The  state of  the transcript logging  is not  affected by  this
  3957.      function.
  3958.      <fname>   the filename string, symbol, or  a file stream created  with
  3959.                OPEN. The extension "wks" is assumed.
  3960.      returns   NIL on failure, otherwise never returns
  3961.  
  3962. (save <fname>)                                     SAVE WORKSPACE TO A FILE
  3963.      You cannot save from within  a load. Not all of the state may be saved
  3964.      -- see "restore", above. By saving  a workspace with the name "xlisp",
  3965.      that  workspace   will  be   loaded  automatically  when   you  invoke
  3966.      XLISP-PLUS.
  3967.      <fname>   the filename string, symbol, or  a file stream created  with
  3968.                OPEN. The extension "wks" is assumed.
  3969.      returns   t if workspace was written, NIL otherwise
  3970.  
  3971. (savefun <fcn>)                                     SAVE FUNCTION TO A FILE
  3972.      defined in init.lsp
  3973.      <fcn>     function name (saves it to file of same name, with extension
  3974.                ".lsp")
  3975.      returns   t if successful
  3976.  
  3977.  
  3978.  
  3979.  
  3980.  
  3981.  
  3982.  
  3983. XLISP 2.1e                    SYSTEM FUNCTIONS                      Page 80
  3984.  
  3985.  
  3986. (dribble [<fname>])            CREATE A FILE WITH A TRANSCRIPT OF A SESSION
  3987.      <fname>   file name string, symbol, or file stream created with OPEN
  3988.                (if missing, close current transcript)
  3989.      returns   t if the transcript is opened, NIL if it is closed
  3990.  
  3991. (gc)                                               FORCE GARBAGE COLLECTION
  3992.      returns   NIL
  3993.  
  3994. (expand [<num>])                           EXPAND MEMORY BY ADDING SEGMENTS
  3995.      <num>     the number of segments to add, default 1
  3996.      returns   the number of segments added
  3997.  
  3998. (alloc <num> [<num2>])                                  CHANGE SEGMENT SIZE
  3999.      <num>     the number of nodes to allocate
  4000.      <num2>    the number  of  pointer elements  to  allocate in  an  array
  4001.                segment (when dynamic array allocation compiled). Default is
  4002.                no change.
  4003.      returns   the old number of nodes to allocate
  4004.  
  4005. (room)                                    SHOW MEMORY ALLOCATION STATISTICS
  4006.      Statistics (which are sent to *STANDARD-OUTPUT*) include:
  4007.                Nodes - number of nodes, free and used
  4008.                Free nodes - number of free nodes
  4009.                Segments - number of node segments, including those reserved
  4010.                          for characters and small integers.
  4011.                Allocate  -  number of  nodes to  allocate  in any  new node
  4012.                          segments
  4013.                Total  - total  memory  bytes allocated  for node  segments,
  4014.                          arrays, and strings
  4015.                Collections - number of garbage collections
  4016.      When dynamic  array allocation  is compiled, the  following additional
  4017.      statistics are printed:
  4018.                Vector  nodes  -  number  of pointers  in  arrays  and (size
  4019.                          equivalent) strings
  4020.                Vector free - free  space in vector area (may  be fragmented
  4021.                          across segments)
  4022.                Vector  segs  - number  of  vector  segments. Increases  and
  4023.                          decreases as needed.
  4024.                Vec allocate - number of pointer elements to allocate in any
  4025.                          new vector segment
  4026.      returns   NIL
  4027.  
  4028. (time <expr>)                                        MEASURE EXECUTION TIME
  4029.      fsubr.
  4030.      <expr>    the expression to evaluate
  4031.      returns   the result of the expression. The  execution time is printed
  4032.                to *TRACE-OUTPUT*
  4033.  
  4034.  
  4035.  
  4036.  
  4037.  
  4038.  
  4039.  
  4040. XLISP 2.1e                    SYSTEM FUNCTIONS                      Page 81
  4041.  
  4042.  
  4043. (get-internal-real-time)                             GET ELAPSED CLOCK TIME
  4044. (get-internal-run-time)                          GET ELAPSED EXECUTION TIME
  4045.      returns   integer      time      in       system      units       (see
  4046.                internal-time-units-per-second  on  page  22).   meaning  of
  4047.                absolute values is system dependent.
  4048.  
  4049. (coerce <expr> <type>)                  FORCE EXPRESSION TO DESIGNATED TYPE
  4050.      Sequences  can  be  coerced  into other  sequences,  single  character
  4051.      strings or  symbols with  single character  printnames can  be coerced
  4052.      into characters, fixnums  can be coerced  into characters or  flonums.
  4053.      Ratios can be coerced  into flonums. Flonums and ratios can be coerced
  4054.      into complex (so can fixnums, but they turn back into fixnums).
  4055.      <expr>    the expression to coerce
  4056.      <type>    desired type, as returned by type-of (see page 81)
  4057.      returns   <expr> if type is correct, or converted object.
  4058.  
  4059. (type-of <expr>)                         RETURNS THE TYPE OF THE EXPRESSION
  4060.      It is recommended that typep  be used instead, as it is  more general.
  4061.      In the original XLISP, the value NIL was returned for NIL.
  4062.      <expr>    the expression to return the type of
  4063.      returns   One of the symbols:
  4064.                LIST                for NIL (lists, conses return CONS)
  4065.                SYMBOL              for symbols
  4066.                OBJECT              for objects
  4067.                CONS                for conses
  4068.                SUBR                for built-in functions
  4069.                FSUBR               for special forms
  4070.                CLOSURE             for defined functions
  4071.                STRING              for strings
  4072.                FIXNUM              for integers
  4073.                RATIO               for ratios
  4074.                FLONUM              for floating point numbers
  4075.                COMPLEX             for complex numbers
  4076.                CHARACTER           for characters
  4077.                FILE-STREAM         for file pointers
  4078.                UNNAMED-STREAM      for unnamed streams
  4079.                ARRAY               for arrays
  4080.                HASH-TABLE          for hash tables
  4081.                sym                 for structures of type "sym"
  4082.  
  4083. (peek <addrs>)                                 PEEK AT A LOCATION IN MEMORY
  4084.      <addrs>   the address to peek at (integer)
  4085.      returns   the value at the specified address (integer)
  4086.  
  4087. (poke <addrs> <value>)                             POKE A VALUE INTO MEMORY
  4088.      <addrs>   the address to poke (integer)
  4089.      <value>   the value to poke into the address (integer)
  4090.      returns   the value
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.  
  4097.  
  4098. XLISP 2.1e                    SYSTEM FUNCTIONS                      Page 82
  4099.  
  4100.  
  4101. (address-of <expr>)                        GET THE ADDRESS OF AN XLISP NODE
  4102.      <expr>    the node
  4103.      returns   the address of the node (integer)
  4104.  
  4105. (get-key)                                     READ A KEYSTROKE FROM CONSOLE
  4106.      OS dependent.
  4107.      returns   integer value of key (no echo)
  4108.  
  4109. (system <command>)                                 EXECUTE A SYSTEM COMMAND
  4110.      OS dependent -- not always available.
  4111.      <command> Command string, if 0 length then spawn OS shell
  4112.      returns   T if successful (note that MS/DOS command.com always returns
  4113.                success)
  4114.  
  4115. (exit)                                                           EXIT XLISP
  4116.      returns   never returns
  4117.  
  4118. (generic <expr>)              CREATE A GENERIC TYPED COPY OF THE EXPRESSION
  4119.      Note: added function, Tom Almy's creation for debugging xlisp.
  4120.      <expr>    the expression to copy
  4121.      returns   NIL if  value is  NIL and NILSYMBOL  compilation option  not
  4122.                declared, otherwise if type is:
  4123.                SYMBOL              copy as an ARRAY
  4124.                OBJECT              copy as an ARRAY
  4125.                CONS                (CONS (CAR <expr>)(CDR <expr>))
  4126.                CLOSURE             copy as an ARRAY
  4127.                STRING              copy of the string
  4128.                FIXNUM              value
  4129.                FLONUM              value
  4130.                RATIO               value
  4131.                CHARACTER           value
  4132.                UNNAMED-STREAM      copy as a CONS
  4133.                ARRAY               copy of the array
  4134.                COMPLEX             copy as an ARRAY
  4135.                HASH-TABLE          copy as an ARRAY
  4136.                structure           copy as an ARRAY
  4137.  
  4138.  
  4139. The following graphic and  display functions represent an extension  by Tom
  4140. Almy:
  4141.  
  4142. (cls)                                                         CLEAR DISPLAY
  4143.      Clear the display and position cursor at upper left corner.
  4144.      returns   nil
  4145.  
  4146. (cleol)                                                CLEAR TO END OF LINE
  4147.      Clears current line to end.
  4148.      returns   nil
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156. XLISP 2.1e                    SYSTEM FUNCTIONS                      Page 83
  4157.  
  4158.  
  4159. (goto-xy [<column> <row>])                       GET OR SET CURSOR POSITION
  4160.      Cursor   is   repositioned  if   optional  arguments   are  specified.
  4161.      Coordinates are clipped to actual size of display.
  4162.      <column>  0-based column (x coordinate)
  4163.      <row>     0-based row (y coordinate)
  4164.      returns   list of original column and row positions
  4165.  
  4166. (color <value>)                                           SET DRAWING COLOR
  4167.      <value>   Drawing color (not checked for validity)
  4168.      returns   <value>
  4169.  
  4170. (move <x1> <y1> [<x2> <y2> ...])                              ABSOLUTE MOVE
  4171. (moverel <x1> <y2> [<x2> <y2> ...])                           RELATIVE MOVE
  4172.      For moverel, all coordinates are relative to the preceeding point.
  4173.      <x1> <y1> Moves to point x1,y1 in anticipation of draw.
  4174.      <x2> <y2> Draws to points specified in additional arguments.
  4175.      returns   T if succeeds, else NIL
  4176.  
  4177. (draw [<x1> <y1> ...])                                        ABSOLUTE DRAW
  4178. (drawrel [<x1> <y1> ...])                                     RELATIVE DRAW
  4179.      For drawrel, all coordinates are relative to the preceeding point.
  4180.      <x1> <y1> Point(s) drawn to, in order.
  4181.      returns   T if succeeds, else NIL
  4182.  
  4183. (mode <ax> [<bx> <width> <height>)                         SET DISPLAY MODE
  4184.      Standard modes  require only <ax> argument. Extended modes are "Super-
  4185.      VGA"  or  "Super-EGA" and  are display  card  specific. Not  all XLISP
  4186.      versions support all modes.
  4187.      <ax>      Graphic mode (value passed in register AX)
  4188.                Common standard Modes:
  4189.                0,1 - 40x25 text
  4190.                2,3 - 80x25 text
  4191.                4,5 - 320x200 4 color graphics (CGA)
  4192.                6 - 640x200 monchrome graphics (CGA)
  4193.                13 - 320x200 16 color graphics (EGA)
  4194.                14 - 640x200 16 color graphics (EGA)
  4195.                16 - 640x350 16 color graphics (EGA)
  4196.                18 - 640x480 16 color graphics (VGA)
  4197.                19 - 320x200 256 color graphics (VGA)
  4198.      <bx>      BX value for some extended graphic modes
  4199.      <width>   width for extended graphic modes
  4200.      <height>  height for extended graphic modes
  4201.      returns   T, or NIL if fails
  4202.  
  4203.  
  4204.  
  4205.  
  4206.  
  4207.  
  4208.  
  4209. XLISP 2.1e                  ADDITIONAL FUNCTIONS                    Page 84
  4210.  
  4211.  
  4212.  
  4213. ADDITIONAL FUNCTIONS AND UTILITIES
  4214.  
  4215. STEP.LSP
  4216.  
  4217. This file  contains a simple Lisp  single-step debugger. It   started as an
  4218. implementation  of the  "hook" example  in chapter  20 of  Steele's "Common
  4219. Lisp". This version was brought up on Xlisp 1.7 for the  Amiga, and then on
  4220. VAXLISP.
  4221.  
  4222. To invoke: (step (whatever-form with args))
  4223.  
  4224. For  each  list   (interpreted  function  call),  the  stepper  prints  the
  4225. environment and the list, then enters a read-eval-print loop. At this point
  4226. the available commands are:
  4227.  
  4228. (a list)<CR>   evaluate  the list  in  the current  environment, print  the
  4229.                result, and repeat.
  4230. <CR>           step into the called function
  4231. anything_else<CR>        step over the called function.
  4232.  
  4233. If the stepper comes to a  form that is not a  list it prints the form  and
  4234. the value, and continues on without stopping.
  4235.  
  4236. Note that stepper commands  are executed in the current  environment. Since
  4237. this  is the case, the stepper commands can change the current environment.
  4238. For example,  a SETF will change an environment variable and thus can alter
  4239. the course of execution.
  4240.  
  4241. Global variables - newline, *hooklevel*
  4242.  
  4243. Functions/macros - while step eval-hool-function step-spaces step-flush
  4244.  
  4245. Note -- an even more powerful  stepper package is in stepper.lsp (documented
  4246. in stepper.doc).
  4247.  
  4248.  
  4249.  
  4250.  
  4251.  
  4252.  
  4253.  
  4254. XLISP 2.1e                  ADDITIONAL FUNCTIONS                    Page 85
  4255.  
  4256.  
  4257. PP.LSP
  4258.  
  4259. In  addition to  the  pretty-printer  itself,  this  file  contains  a  few
  4260. functions that illustrate some simple but useful applications.
  4261.  
  4262. (pp <object> [<stream>])                            PRETTY PRINT EXPRESSION
  4263. (pp-def <funct> [<stream>])                     PRETTY PRINT FUNCTION/MACRO
  4264. (pp-file <file> [<stream>])                               PRETTY PRINT FILE
  4265.      <object>  The expression to print
  4266.      <funct>   Function to print (as DEFUN or DEFMACRO)
  4267.      <file>    File to print (specify either as string or quoted symbol)
  4268.      <stream>  Output stream (default is *standard-output*)
  4269.      returns   T
  4270.  
  4271. Global variables: tabsize maxsize miser-size min-miser-car max-normal-car
  4272.  
  4273. Functions/Macros: sym-function pp-file pp-def make-def pp pp1 moveto spaces
  4274. pp-rest-across     pp-rest    printmacrop     pp-binding-form    pp-do-form
  4275. pp-defining-form pp-pair-form
  4276.  
  4277. See the source file for more information.
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285. XLISP 2.1e                  ADDITIONAL FUNCTIONS                    Page 86
  4286.  
  4287.  
  4288. REPAIR.LSP
  4289.  
  4290. This file contains a structure editor.
  4291. Execute
  4292.      (repair 'symbol) to edit a symbol.
  4293.      (repairf  symbol) to  edit the  function binding  of a  symbol (allows
  4294.                changing  the  argument list  or  function  type, lambda  or
  4295.                macro).
  4296.  
  4297. The  editor alters  the current selection  by copying so  that aborting all
  4298. changes  is generally posible; the exception is  when editing a closure, if
  4299. the closure is BACKed out of, the change is permanent.
  4300.  
  4301. For  all  commands taking  a  numeric argument,  the  first element  of the
  4302. selection is the 0th (as in NTH function).
  4303.  
  4304. Any  array elements  become lists  when they  are selected,  and return  to
  4305. arrays upon RETURN or BACK commands.
  4306.  
  4307. Do  not create  new closures,  because the  environment will  be incorrect.
  4308. Closures  become LAMBDA  or MACRO  expressions as  the selection.  Only the
  4309. closure  body  may be  changed; the  argument  list cannot  be successfully
  4310. modified, nor can the environment.
  4311.  
  4312. For class objects, only the methods and message names can  be modified. For
  4313. instance  objects, instance  variables  can  be  examined  (if  the  object
  4314. under-stands  the message :<ivar> for the particular ivar), and changed (if
  4315. :SET-IVAR is defined for that class, as it is if CLASSES.LSP is used).
  4316.  
  4317. (command list on next page)
  4318.  
  4319.  
  4320.  
  4321.  
  4322.  
  4323.  
  4324.  
  4325. XLISP 2.1e                  ADDITIONAL FUNCTIONS                    Page 87
  4326.  
  4327.  
  4328. COMMANDS (general):
  4329.      ?         list available commands for the selection.
  4330.      RETURN    exit, saving all changes.
  4331.      ABORT     exit, without changes.
  4332.      BACK      go back one level (as before CAR CDR or N commands).
  4333.      B n       go back n levels.
  4334.      L         display selection using pprint; if selection is symbol, give
  4335.                short description.
  4336.      MAP       pprints each element of selection, or if selection is symbol
  4337.                then gives complete description of properties.
  4338.      PLEV x    set    *print-level*    to    x.   (Initial    default    is
  4339.                *rep-print-level*)
  4340.      PLEN x    set    *print-length   to    x.    (Initial    default    is
  4341.                *rep-print-length*)
  4342.      EVAL x    evaluates  x and prints result. The symbol @ is bound to the
  4343.                selection.
  4344.      REPLACE x replaces the current selection  with evaluated x. The symbol
  4345.                @ is bound to the selection.
  4346. COMMANDS (if selection is symbol):
  4347.      VALUE     edit the value binding.
  4348.      FUNCTION  edit the function binding (must be a closure).
  4349.      PROP x    edit property x.
  4350. COMMANDS (if selection is list):
  4351.      CAR       select the CAR of the current selection.
  4352.      CDR       select the CDR of the current selection.
  4353.      n         where  n  is  small non-negative  integer,  changes  current
  4354.                selection to (NTH n list).
  4355.      SUBST x y all occurances of (quoted)  y are replaced with  (quoted) x.
  4356.                EQUAL is used for the comparison.
  4357.      RAISE n   removes parenthesis surrounding nth element of selection.
  4358.      LOWER n m inserts  parenthesis starting  with the  nth element,  for m
  4359.                elements.
  4360.      ARRAY n m as in LOWER, but makes elements into an array.
  4361.      I n x     inserts (quoted) x before nth element in selection.
  4362.      R n x     replaces nth element in selection with (quoted) x.
  4363.      D n       deletes nth element in selection.
  4364.  
  4365. All function  names and  global variables start  with the string  "rep-" or
  4366. "*rep-*".
  4367.  
  4368.  
  4369.  
  4370.  
  4371.  
  4372.  
  4373.  
  4374. XLISP 2.1e                BUG FIXES AND EXTENSIONS                  Page 88
  4375.  
  4376.  
  4377.  
  4378. BUG FIXES AND EXTENSIONS
  4379.  
  4380.  
  4381. In this section,  CL means "Common Lisp compatible to the extent possible".
  4382. CX  means "now  works  with  complex numbers".  CR  means  "now works  with
  4383. ratios".  *  means   "implemented  in   LISP  rather  than   C".  #   means
  4384. "implementation moved from LISP to C".
  4385.  
  4386.                                  Bug Fixes
  4387.  
  4388. RESTORE did  not work -- several  bugs for 80x86 systems.  Only one restore
  4389. would work per session -- all systems.
  4390.  
  4391. :downcase for variable *printcase* did not work with some compilers.
  4392.  
  4393. Modifications to make the source acceptable to ANSI C compilers.
  4394.  
  4395. Values for  ADEPTH and EDEPTH  changed to more reasonable  values -- before
  4396. this change the processor stack would overflow first, causing a crash.
  4397.  
  4398. On systems  with 16  bit integers:  STRCAT crashes  when aggregate size  of
  4399. argument strings  were greater  than 32k.  MAKE-ARRAY crashes  on too-large
  4400. arrays.   DOTIMES,   AREF,   AREF   and   NTH   place    forms   of   SETF,
  4401. MAKE-STRING-INPUT-STREAM    and   GET-OUTPUT-STREAM-STRING  treat   numeric
  4402. argument  modulo   65536.  MAKE-STRING-INPUT-STREAM   did  not   check  for
  4403. start>end.
  4404.  
  4405. Strings containing nulls could not be read or printed.
  4406.  
  4407. NTH and NTHCDR failed for zero length lists.
  4408.  
  4409. Unnamed streams did not survive garbage collections.
  4410.  
  4411. (format nil ...) did not protect from garbage collection the unnamed stream
  4412. it creates.
  4413.  
  4414. SORT did not protect some pointers from garbage collection.
  4415.  
  4416. SYMBOL-NAME SYMBOL-VALUE SYMBOL-PLIST BOUNDP and FBOUNDP failed with symbol
  4417. NIL as argument.
  4418.  
  4419. LAST returned wrong value when its argument list ended with a dotted pair.
  4420.  
  4421. *gc-hook*  was  not rebound  to NIL  during  execution of  gchook function,
  4422. causing potential infinite recursion and crash.
  4423.  
  4424. Executing  RETURN from within a DOLIST or DOTIMES caused the environment to
  4425. be wrong.
  4426.  
  4427.  
  4428.  
  4429.  
  4430.  
  4431.  
  4432.  
  4433. XLISP 2.1e                BUG FIXES AND EXTENSIONS                  Page 89
  4434.  
  4435.  
  4436. When errors occured  during loading, which were not caught,  the file would
  4437. be  left open. EVAL  and LOAD  did not  use global  environment. EVALHOOK's
  4438. default environment was not global.
  4439.  
  4440. Invalid symbols (those containing control characters, for instance), can no
  4441. longer be created with intern and make-symbol.
  4442.  
  4443. The key T, meaning "otherwise"  in the CASE function used to be  allowed in
  4444. any position. Now it only means "otherwise" when used as the last case.
  4445.  
  4446. The lexical and functional  environment of send of :answer (which defines a
  4447. new method)  are now used during  the method's evaluation, rather  than the
  4448. global environment.
  4449.  
  4450. Signatures added for WKS files so that invalid ones will be rejected.
  4451.  
  4452. Checks added for file names and identifier names being too long.
  4453.  
  4454. Indexing code fixed to allow  almost 64k long strings in 16 bit systems. It
  4455. is no longer possible to allocate arrays  or strings that are too long  for
  4456. the underlying system.
  4457.  
  4458. Circularity  checks added  to  PRINT LAST  BUTLAST  LENGTH MEMBER  and  MAP
  4459. functions.  An error is  produced for  all but  MEMBER, which  will execute
  4460. correctly.
  4461.  
  4462. Code for  SETF modified so that  a Common Lisp compatible  DEFSETF could be
  4463. used.
  4464.  
  4465.                            User Interface Changes
  4466.  
  4467. -w command line argument to specify alternate or no workspace.
  4468.  
  4469. -b command line argument for batch operation.
  4470.  
  4471. -? command line argument gives usage message.
  4472.  
  4473. init.lsp not loaded if workspace loaded.
  4474.  
  4475. Search path can be provided for workspaces and .lsp files.
  4476.  
  4477. Standard  input and output  can be  redirected. *TERMINAL-IO*  stream added
  4478. which is always bound to console (stderr).
  4479.  
  4480. Non-error  messages   are  sent  to   *DEBUG-IO*  so  they   don't  clutter
  4481. *STANDARD-OUTPUT*
  4482.  
  4483. Results of evaluations are  printed on a fresh line rather  than at the end
  4484. of the preceeding line (if any). This enhances readability.
  4485.  
  4486. Display writes are buffered.
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.  
  4493.  
  4494. XLISP 2.1e                BUG FIXES AND EXTENSIONS                  Page 90
  4495.  
  4496.  
  4497. Character literals available for all 256 values. CL
  4498.  
  4499. Uninterned symbols print with leading #:. CL
  4500.  
  4501. PRIN1  generates   appropriate  escape  sequences  for   control  and  meta
  4502. characters in strings. CL
  4503.  
  4504. Read macro #. added. CL
  4505.  
  4506. Lisp code for nested backquote macros added. CL
  4507.  
  4508. Read macro #C added for complex numbers. CL
  4509.  
  4510. Semantics  for #S  read macro  changed so  that it  can read  in structures
  4511. written by PRINT. CL
  4512.  
  4513. PRINT of file streams shows file name, or "closed" if a closed file stream.
  4514.  
  4515. *PRINT-CASE* now applies to PRINC. CL
  4516.  
  4517. Added  *READTABLE-CASE* to  control case  conversion  on input  and output,
  4518. allowing case sensitive code. CL-like
  4519.  
  4520. Reader macros #+ and #- added, along with global variable *FEATURES*. CL
  4521.  
  4522.  
  4523.  
  4524.                            New/Changed Data Types
  4525.  
  4526. NIL -- was treated as a special case, now just a normal symbol.
  4527. symbols -- value binding can optionally be constant or special.
  4528. ratio numbers -- new type.
  4529. complex numbers -- new type, can be integer or real.
  4530. character strings -- The ASCII NUL (code 0) is now a valid character.
  4531. objects -- objects of class Class have a new instance variable which is the
  4532.      print name of the class.
  4533. hash-table -- new type, close to CL
  4534. random-state -- new type, CL
  4535. Property list properties are no longer limited to just symbols CL
  4536.  
  4537.  
  4538.                         New Variables and Constants
  4539.  
  4540. *apply-hook* Now activated
  4541. *displace-macros* Macros  are replaced with their  expansions when possible
  4542.      *dos-input*  MSDOS  only, uses  DOS interface  to interact  with user.
  4543.      Allows recall of earlier command(s).
  4544. *print-level* CL
  4545. *print-length* CL
  4546. *random-state* CL
  4547. *ratio-format*
  4548.  
  4549.  
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555. XLISP 2.1e                BUG FIXES AND EXTENSIONS                  Page 91
  4556.  
  4557.  
  4558. *readtable-case* CL-like
  4559. *terminal-io* CL
  4560. internal-time-units-per-second CL
  4561. pi CL
  4562.  
  4563.  
  4564.                                New functions
  4565.  
  4566. ACONS CL*
  4567. ACOSH CL*
  4568. ADJOIN CL
  4569. ALPHA-CHAR-P CL
  4570. APPLYHOOK CL
  4571. ASH CL
  4572. ASINH CL*
  4573. ATANH CL*
  4574. BUTLAST CL
  4575. CEILING CL
  4576. CIS CL*
  4577. CLREOL (clear to end of line -- MS/DOS only)
  4578. CLRHASH CL
  4579. CLS (clear screen -- MS/DOS only)
  4580. COERCE CL
  4581. COLOR (graphics -- MS/DOS only)
  4582. COMPLEX CL
  4583. COMPLEXP CL
  4584. CONCATENATE CL
  4585. CONJUGATE CL
  4586. CONSTANTP CL
  4587. COPY-ALIST CL*
  4588. COPY-LIST CL*
  4589. COPY-TREE CL*
  4590. COSH CL*
  4591. COUNT-IF CL except no :from-end
  4592. DECF CL*
  4593. DEFCLASS * (define a new class)
  4594. DEFINST * (define a new instance)
  4595. DEFMETHOD * (define a new method)
  4596. DEFSETF CL*
  4597. DELETE-FILE CL
  4598. DENOMINATOR CL
  4599. DRAW (graphics -- MS/DOS only)
  4600. DRAWREL (graphics -- MS/DOS only)
  4601. ELT CL
  4602. EQUALP CL*
  4603. EVERY CL
  4604. FILE-LENGTH CL
  4605. FILE-POSITION CL
  4606. FILL CL*
  4607. FIND-IF CL except no :from-end
  4608. FLOOR CL
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.  
  4616. XLISP 2.1e                BUG FIXES AND EXTENSIONS                  Page 92
  4617.  
  4618.  
  4619. FRESH-LINE CL
  4620. FUNCTIONP CL*
  4621. GENERIC (implementation debugging function)
  4622. GET-INTERNAL-REAL-TIME CL
  4623. GET-INTERNAL-RUN-TIME CL
  4624. GETHASH CL
  4625. GOTO-XY (position cursor -- MS/DOS only)
  4626. HASH-TABLE-COUNT CL
  4627. IDENTITY CL*
  4628. IMAGPART CL
  4629. INCF CL*
  4630. INPUT-STREAM-P CL
  4631. INTERSECTION CL
  4632. LCM CL
  4633. LIST* CL
  4634. LOG CL
  4635. LOGTEST CL*
  4636. MAKE-HASK-TABLE CL
  4637. MAKE-RANDOM-STATE CL
  4638. MAP CL
  4639. MAPHASH CL
  4640. MODE (graphics -- MS/DOS only)
  4641. MOVE (graphics -- MS/DOS only)
  4642. MOVEREL (graphics -- MS/DOS only)
  4643. NINTERSECTION CL*
  4644. NOTANY CL
  4645. NOTEVERY CL
  4646. NREVERSE CL
  4647. NSET-DIFFERENCE CL*
  4648. NSET-EXCLUSIVE-OR CL*
  4649. NUMERATOR CL
  4650. NUNION CL*
  4651. OPEN-STREAM-P CL
  4652. OUTPUT-STREAM-P CL
  4653. PAIRLIS CL*
  4654. PHASE CL
  4655. POP CL*
  4656. POSITION-IF CL except no :from-end
  4657. PUSH CL*
  4658. PUSHNEW CL*
  4659. RATIONAL CL
  4660. RATIONALP CL
  4661. REALPART CL
  4662. REDUCE CL except no :from-end
  4663. REMHASH CL
  4664. REMOVE-DUPLICATES CL except no :from-end
  4665. REPLACE CL*
  4666. ROUND CL
  4667. SEARCH CL except no :from-end
  4668. SET-DIFFERENCE CL
  4669. SET-EXCLUSIVE-OR CL*
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677. XLISP 2.1e                BUG FIXES AND EXTENSIONS                  Page 93
  4678.  
  4679.  
  4680. SETF Placeform ELT  CL
  4681. SETF Placeform GETHASH  CL
  4682. SETF Placeform SEND* (set instance variable)
  4683. SIGNUM CL*
  4684. SINH CL*
  4685. SOME CL
  4686. SUBSETP CL
  4687. TANH CL*
  4688. TIME CL
  4689. TRUENAME CL
  4690. TYPEP CL
  4691. UNINTERN CL*
  4692. UNION CL
  4693. WITH-INPUT-FROM-STRING CL*
  4694. WITH-OPEN-FILE CL*
  4695. WITH-OUTPUT-TO-STRING CL*
  4696. Y-OR-N-P CL*
  4697.  
  4698.  
  4699.                              Changed functions
  4700.  
  4701. &ALLOW-OTHER-KEYS CL (now functions, is no longer ignored)
  4702. * CL CR CX (with no arguments, returns 1)
  4703. + CL CR CX (with no arguments, returns 0)
  4704. - CL CR CX
  4705. / CL CR CX
  4706. 1+ CL CR CX
  4707. 1- CL CR CX
  4708. ABS CL CR CX
  4709. ACOS CL CR CX
  4710. ALLOC (new optional second argument)
  4711. APPLY CL (allows multiple arguments)
  4712. AREF CL (now works on strings)
  4713. ASIN CL CR CX
  4714. ASSOC CL (added :key)
  4715. ATAN CL CR CX (second argument now allowed)
  4716. CHAR-CODE CL (parity bit is stripped)
  4717. CLOSE CL (will close unnamed stream strings)
  4718. COS CL CR CX
  4719. DEFCONSTANT CL# (true constants)
  4720. DEFPARAMETER CL# (true special variables)
  4721. DEFSTRUCT (added option :print-function)
  4722. DEFVAR CL# (true special variables)
  4723. DELETE (added keywords :key :start :end. Works on arrays and strings)
  4724. DELETE-IF (added keywords :key :start :end. Works on arrays and strings) 
  4725. DELETE-IF-NOT  (added  keywords  :key  :start  :end. Works  on  arrays  and
  4726.      strings) 
  4727. EXP CL CR CX
  4728. EXPT CL CR CX
  4729. FORMAT (added directives ~D ~E ~F ~G ~& ~T ~\N and lowercase directives) 
  4730. HASH (hashes everything, not just symbols or strings)
  4731.  
  4732.  
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738. XLISP 2.1e                BUG FIXES AND EXTENSIONS                  Page 94
  4739.  
  4740.  
  4741. LOAD CL (uses path to find file, allows file stream for name argument) 
  4742. LOGAND CL (with no arguments, returns -1)
  4743. LOGIOR CL (with no arguments, returns 0)
  4744. LOGXOR CL (with no arguments returns 0)
  4745. MAKE-STRING-INPUT-STREAM CL (:end NIL means end of string)
  4746. MAKUNBOUND #
  4747. MAPCAN #
  4748. MAPCON #
  4749. MEMBER CL (added :key)
  4750. NSTRING-DOWNCASE CL (string argument can  be symbol, :end NIL means  end of
  4751.      string)
  4752. NSTRING-UPCASE CL  (string argument can  be symbol,  :end NIL means  end of
  4753.      string)
  4754. OPEN CL (many additional options, as in Common Lisp)
  4755. PEEK (fixnum sized location is fetched)
  4756. PEEK-CHAR CL (input stream NIL is *standard-input*, T is *terminal-io*) 
  4757. POKE (fixnum sized location is stored)
  4758. PPRINT (output stream NIL is *standard-output*, T is *terminal-io*)
  4759. PRIN1 CL (output stream NIL is *standard-output*, T is *terminal-io*)
  4760. PRINC CL (output stream NIL is *standard-output*, T is *terminal-io*)
  4761. PRINT (output stream NIL is *standard-output*, T is *terminal-io*)
  4762. RANDOM CL (works with random-states)
  4763. READ (input stream NIL is *standard-input*, T is *terminal-io*)
  4764. READ-BYTE CL (input stream NIL is *standard-input*, T is *terminal-io*) 
  4765. READ-CHAR CL (input stream NIL is *standard-input*, T is *terminal-io*) 
  4766. READ-LINE CL (input stream NIL is *standard-input*, T is *terminal-io*) 
  4767. REM CR CL (only two arguments now allowed, may be floating point)
  4768. REMOVE (added keywords :key :start :end. Works on arrays and strings)
  4769. REMOVE-IF (added keywords :key :start :end. Works on arrays and strings) 
  4770. REMOVE-IF-NOT (added  keywords  :key  :start  :end.  Works  on  arrays  and
  4771.      strings) 
  4772. RESTORE (uses  path to find file, restores file streams, fine name argument
  4773.      may be file stream)
  4774. REVERSE CL (works on arrays and strings)
  4775. SAVE (file name argument may be file stream)
  4776. SIN CL CR CX
  4777. SORT (added :key)
  4778. SQRT CL CR CX
  4779. STRCAT * (now a macro, use of CONCATENATE is recommended)
  4780. STRING-comparisonFunctions CL (string arguments can be symbols)
  4781. STRING-DOWNCASE CL  (string argument can  be symbol, :end NIL  means end of
  4782.      string)
  4783. STRING-LEFT-TRIM CL (string argument can be symbol)
  4784. STRING-RIGHT-TRIM CL (string argument can be symbol)
  4785. STRING-TRIM CL (string argument can be symbol)
  4786. STRING-UPCASE  CL (string argument  can be  symbol, :end  NIL means  end of
  4787.      string) 
  4788. SUBLIS CL (modified to do minimum copying)
  4789. SUBSEQ CL (works on arrays and lists)
  4790. SUBST CL (modified to do minimum copying)
  4791. TAN CL CR CX
  4792.  
  4793.  
  4794.  
  4795.  
  4796.  
  4797.  
  4798.  
  4799. XLISP 2.1e                BUG FIXES AND EXTENSIONS                  Page 95
  4800.  
  4801.  
  4802. TERPRI CL (output stream NIL is *standard-output*, T is *terminal-io*) 
  4803. TRUNCATE CR CL (allows denominator argument)
  4804. TYPE-OF (returns HASH-TABLE  for hashtables, COMPLEX for complex,  and LIST
  4805.      for NIL)
  4806. UNTRACE CL (with no arguments, untraces all functions)
  4807. WRITE-BYTE CL (output stream NIL is *standard-output*, T is *terminal-io*) 
  4808. WRITE-CHAR CL (output stream NIL is *standard-output*, T is *terminal-io*)
  4809.  
  4810.  
  4811.                        New messages for class Object
  4812.  
  4813. :prin1 <stream>
  4814. :superclass *
  4815. :ismemberof <cls> *
  4816. :iskindof <cls> *
  4817. :respondsto <selector> * 
  4818. :storeon (returns form that will create a copy of the object) *
  4819.  
  4820.                         New messages for class Class
  4821.  
  4822. :superclass *
  4823. :messages *
  4824. :storeon (returns form that will recreate class and methods) *
  4825.  
  4826.  
  4827.  
  4828.  
  4829.  
  4830.  
  4831.  
  4832. XLISP 2.1e                        EXAMPLES                          Page 96
  4833.  
  4834.  
  4835.  
  4836. EXAMPLES: FILE I/O FUNCTIONS
  4837.  
  4838.  
  4839. Input from a File
  4840.  
  4841. To open a file for input, use  the OPEN function with the keyword  argument
  4842. :DIRECTION set  to :INPUT. To open a file for output, use the OPEN function
  4843. with  the keyword  argument :DIRECTION  set to  :OUTPUT. The  OPEN function
  4844. takes  a single  required argument  which  is the  name of  the file  to be
  4845. opened. This  name can be  in the form  of a string  or a symbol.  The OPEN
  4846. function returns  an object of type  FILE-STREAM if it succeeds  in opening
  4847. the specified  file. It  returns the  value NIL if  it fails.  In order  to
  4848. manipulate the file, it is necessary to save the value returned by the OPEN
  4849. function. This is usually done by assigning it to a variable  with the SETQ
  4850. special form or by binding it using LET or LET*. Here is an example:
  4851.  
  4852.     (setq fp (open "init.lsp" :direction :input))
  4853.  
  4854. Evaluating this expression will result in the file "init.lsp" being opened.
  4855. The file object that will be returned by the OPEN function will be assigned
  4856. to the variable "fp".
  4857.  
  4858. It  is now possible to  use the file for input.  To read an expression from
  4859. the file,  just supply  the  value of  the "fp"  variable  as the  optional
  4860. "stream" argument to READ.
  4861.  
  4862.     (read fp)
  4863.  
  4864. Evaluating this expression will result in reading the first expression from
  4865. the  file "init.lsp". The expression will be  returned as the result of the
  4866. READ  function. More  expressions can be  read from the  file using further
  4867. calls to the READ function. When there are no more expressions to read, the
  4868. READ function will return NIL (or whatever value was supplied as the second
  4869. argument to READ).
  4870.  
  4871. Once  you are done reading from the file, you should close it. To close the
  4872. file, use the following expression:
  4873.  
  4874.     (close fp)
  4875.  
  4876. Evaluating this expression will cause the file to be closed.
  4877.  
  4878.  
  4879.  
  4880.  
  4881.  
  4882.  
  4883.  
  4884. XLISP 2.1e                        EXAMPLES                          Page 97
  4885.  
  4886.  
  4887.  
  4888. Output to a File
  4889.  
  4890. Writing to a file is pretty much the same  as reading from one. You need to
  4891. open the file first. This time you should use the OPEN function to indicate
  4892. that you will do output to the file. For example:
  4893.  
  4894.     (setq fp (open "test.dat" :direction :output :if-exists :supersede))
  4895.  
  4896. Evaluating this expression will open the file "test.dat" for output. If the
  4897. file already exists, its  current contents will be discarded. If it doesn't
  4898. already exist, it will be  created. In any case, a FILE-STREAM  object will
  4899. be  returned by the OPEN function. This file object will be assigned to the
  4900. "fp" variable.
  4901.  
  4902. It is now possible to write to this file by supplying the value of the "fp"
  4903. variable as the optional "stream" parameter in the PRINT function.
  4904.  
  4905.     (print "Hello there" fp)
  4906.  
  4907. Evaluating  this expression will result  in the string  "Hello there" being
  4908. written to the file "test.dat". More data  can be written to the file using
  4909. the same technique.
  4910.  
  4911. Once  you are done  writing to  the file, you  should close it.  Closing an
  4912. output file is just like closing an input file.
  4913.  
  4914.     (close fp)
  4915.  
  4916. Evaluating  this  expression  will  close  the  output  file  and  make  it
  4917. permanent.
  4918.  
  4919.  
  4920.  
  4921. A Slightly More Complicated File Example
  4922.  
  4923. This  example shows how to open a  file, read each Lisp expression from the
  4924. file and print  it. It  demonstrates the use  of files and  the use of  the
  4925. optional "stream" argument to the READ
  4926. function.
  4927.  
  4928.     (do* ((fp (open "test.dat" :direction :input))
  4929.           (ex (read fp) (read fp)))
  4930.          ((null ex) (close fp) nil)
  4931.       (print ex))
  4932.  
  4933. The file will be closed with the next garbage collection.
  4934.  
  4935.  
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941. XLISP 2.1e                         INDEX                            Page 98
  4942.  
  4943.  
  4944. INDEX
  4945.  
  4946. :answer  20                             :supersede  72
  4947. :append  72                             :test       27,   31,   34-36,
  4948. :class  19                                        39-41, 59
  4949. :conc-name  53                          :test-not        27,    34-36,
  4950. :constituent  12                                  39-41, 59
  4951. :create  72                             :tmacro  12
  4952. :direction  72                          :upcase  14
  4953. :downcase  14                           :verbose  79
  4954. :element-type  72                       :white-space  12
  4955. :end  34-36, 49, 74                     +  23, 44
  4956. :end1  34, 37, 50                       ++  23
  4957. :end2  34, 37, 50                       +++  23
  4958. :error  72                              -  23, 44
  4959. :if-does-not-exist  72                  *  23, 44
  4960. :if-exists  72                          **  23
  4961. :include  53                            ***  23
  4962. :initial-value  36                      *applyhook*  8, 22
  4963. :input  72                              *breakenable*  4, 22
  4964. :invert  14                             *debug-io*  22
  4965. :io  72                                 *displace-macros*  7, 23
  4966. :iskindof  19                           *dos-input*  2, 23
  4967. :ismemberof  19                         *error-output*  22
  4968. :isnew  19, 20                          *evalhook*  8, 22
  4969. :key  27, 34-36, 39-42, 59              *features*  13, 23
  4970. :mescape  12                            *float-format*  23, 67
  4971. :messages  20                           *gc-flag*  23
  4972. :new  20                                *gc-hook*  8, 23
  4973. :new-version  72                        *integer-format*  23, 67
  4974. :nmacro  12                             *obarray*  22
  4975. :output  72                             *print-case*  14, 23, 67
  4976. :overwrite  72                          *print-length*  23, 67
  4977. :preserve  14                           *print-level*  23, 67
  4978. :prin1  19                              *random-state*  23
  4979. :print  79                              *ratio-format*  23, 67
  4980. :print-function  53                     *readtable-case*  14, 23, 67
  4981. :probe  72                              *readtable*  12, 22
  4982. :rename  72                             *standard-input*  22
  4983. :rename-and-delete  72                  *standard-output*  22
  4984. :respondsto  19                         *struct-slots*  53
  4985. :sescape  12                            *terminal-io*  22
  4986. :set-ivar  55                           *trace-output*  22
  4987. :set-pname  55                          *tracelimit*  4, 22
  4988. :show  19                               *tracelist*  22
  4989. :size  31                               *tracenable*  4, 22
  4990. :start  34-36, 49, 74                   *unbound*  22
  4991. :start1  34, 37, 50                     /  44
  4992. :start2  34, 37, 50                     /=  47
  4993. :storeon  19, 20                        <  47
  4994. :superclass  19, 20                     <=  47
  4995.  
  4996.  
  4997.  
  4998.  
  4999.  
  5000.  
  5001.  
  5002. XLISP 2.1e                         INDEX                            Page 99
  5003.  
  5004.  
  5005. =  47                                   char-lessp  52
  5006. >  47                                   char-not-equal  52
  5007. >=  47                                  char-not-greaterp  52
  5008. &allow-other-keys  16                   char-not-lessp  52
  5009. &aux  16                                char-upcase  51
  5010. &key  16                                char/=  52
  5011. &optional  16                           char<  52
  5012. &rest  16                               char<=  52
  5013. 1+  44                                  char=  52
  5014. 1-  44                                  char>  52
  5015. abs  45                                 char>=  52
  5016. acons  38                               CHARACTER  81
  5017. acos  45                                characterp  58
  5018. acosh  46                               cis  46
  5019. address-of  82                          class  22
  5020. adjoin  41                              classp  58
  5021. alloc  80                               clean-up  3, 77
  5022. alpha-char-p  51                        clean-up,  4
  5023. and  60, 61                             close  73
  5024. append  38                              CLOSURE  81
  5025. apply  24                               clrhash  31
  5026. applyhook  8, 78                        cls  82
  5027. aref  26, 32                            code-char  51
  5028. ARRAY  81                               coerce  81
  5029. arrayp  58                              color  83
  5030. ash  48                                 comma  24
  5031. asin  45                                comma-at  24
  5032. asinh  46                               complex  47, 81
  5033. assoc  39                               complexp  58
  5034. atan  45                                concatenate  33
  5035. atanh  46                               cond  61
  5036. atom  57, 60                            conjugate  47
  5037. backquote  24                           cons  38, 81
  5038. baktrace  77                            consp  57
  5039. block  65                               constantp  57
  5040. both-case-p  51                         continue  3, 4, 77
  5041. boundp  58                              copy-alist  40
  5042. break  77                               copy-list  40
  5043. butlast  38                             copy-tree  41
  5044. car  26, 38                             cos  45
  5045. case  62                                cosh  46
  5046. catch  62                               count-if  35
  5047. cdr  26, 38                             cxxr  38
  5048. ceiling  43                             cxxxr  38
  5049. cerror  77                              cxxxxr  38
  5050. char  51                                debug  78
  5051. char-code  51                           decf  28
  5052. char-downcase  51                       defclass  55
  5053. char-equal  52                          defconstant  29
  5054. char-greaterp  52                       definst  56
  5055. char-int  52                            defmacro  28
  5056.  
  5057.  
  5058.  
  5059.  
  5060.  
  5061.  
  5062.  
  5063. XLISP 2.1e                         INDEX                           Page 100
  5064.  
  5065.  
  5066. defmethod  55                           fmakunbound  29
  5067. defparameter  29                        format  69
  5068. defsetf  27                             fourth  38
  5069. defstruct  53                           fresh-line  68
  5070. defun  28                               FSUBR  81
  5071. defvar  29                              funcall  24
  5072. delete  35                              function  24, 60
  5073. delete-file  73                         functionp  59
  5074. delete-if  36                           gc  80
  5075. delete-if-not  36                       gcd  45
  5076. denominator  46                         generic  82
  5077. digit-char  52                          gensym  28
  5078. digit-char-p  51                        get  26, 30
  5079. do  64                                  get-internal-real-time  81
  5080. do*  64                                 get-internal-run-time  81
  5081. dolist  64                              get-key  82
  5082. dotimes  64                             get-lambda-expression  25
  5083. draw  83                                get-macro-character  67
  5084. drawrel  83                             get-output-stream-list  75
  5085. dribble  80                             get-output-stream-string  75
  5086. elt  26, 33                             gethash  26, 31
  5087. endp  57                                go  65
  5088. eq  60                                  goto-xy  83
  5089. eql  60                                 hash  28
  5090. equal  60                               HASH-TABLE  81
  5091. equalp  60                              hash-table-count  31
  5092. error  77                               identity  24
  5093. errset  4, 77                           if  61
  5094. eval  24                                imagpart  47
  5095. evalhook  8, 78                         incf  28
  5096. evenp  59                               input-stream-p  58
  5097. every  33                               int-char  52
  5098. exit  82                                integerp  57
  5099. exp  46                                 intern  28
  5100. expand  80                              internal-time-units-per-second
  5101. expt  46                                          22
  5102. fboundp  59                             intersection  41
  5103. file-length  73                         labels  62
  5104. file-position  74                       lambda  25
  5105. FILE-STREAM  81                         last  38
  5106. fill  36                                lcm  45
  5107. find-if  35                             length  33
  5108. first  38                               let  62
  5109. FIXNUM  81                              let*  62
  5110. flatc  68                               list  38, 60, 81
  5111. flatsize  68                            list*  38
  5112. flet  62                                listp  57
  5113. float  43                               load  79
  5114. floatp  57                              log  46
  5115. FLONUM  81                              logand  48
  5116. floor  43                               logior  48
  5117.  
  5118.  
  5119.  
  5120.  
  5121.  
  5122.  
  5123.  
  5124. XLISP 2.1e                         INDEX                           Page 101
  5125.  
  5126.  
  5127. lognot  48                              objectp  58
  5128. logtest  48                             oddp  59
  5129. logxor  48                              open  72
  5130. loop  64                                open-stream-p  58
  5131. lower-case-p  51                        or  60, 61
  5132. macroexpand  25                         output-stream-p  58
  5133. macroexpand-1  25                       pairlis  40
  5134. macrolet  62                            peek  81
  5135. make-array  32                          peek-char  71
  5136. make-hash-table  31                     phase  47
  5137. make-random-state  45                   pi  22
  5138. make-string-input-stream  75            plusp  59
  5139. make-string-output-stream  75           poke  81
  5140. make-symbol  28                         pop  27
  5141. makunbound  29                          position-if  35
  5142. map  33                                 pp  85
  5143. mapc  39                                pprint  68
  5144. mapcan  40                              prin1  67
  5145. mapcar  39                              princ  68
  5146. mapcon  40                              print  67
  5147. maphash  31                             prog  65
  5148. mapl  39                                prog*  65
  5149. maplist  39                             prog1  66
  5150. max  44                                 prog2  66
  5151. member  39, 60                          progn  66
  5152. min  44                                 progv  65
  5153. minusp  59                              psetq  26
  5154. mod  44                                 push  27
  5155. mode  83                                pushnew  27
  5156. move  83                                putprop  30
  5157. moverel  83                             quote  24
  5158. nconc  42                               random  45
  5159. NIL  22                                 RATIO  81
  5160. nintersection  41                       RATIONAL  60
  5161. nodebug  78                             rationalp  58
  5162. not  57, 60                             read  67
  5163. notany  33                              read-byte  73
  5164. notevery  33                            read-char  71
  5165. nreverse  33                            read-line  71
  5166. nset-difference  41                     realpart  47
  5167. nset-exclusive-or  41                   reduce  36
  5168. nstring-downcase  49                    rem  44
  5169. nstring-upcase  49                      remhash  31
  5170. nth  26, 39                             remove  34
  5171. nthcdr  39                              remove-duplicates  36
  5172. null  57, 60                            remove-if  34
  5173. NUMBER  60                              remove-if-not  34
  5174. numberp  57                             remprop  30
  5175. numerator  46                           repair  86
  5176. nunion  41                              repairf  86
  5177. object  22, 60, 81                      replace  37
  5178.  
  5179.  
  5180.  
  5181.  
  5182.  
  5183.  
  5184.  
  5185. XLISP 2.1e                         INDEX                           Page 102
  5186.  
  5187.  
  5188. rest  38                                STRUCT  60
  5189. restore  79                             sublis  40
  5190. return  65                              SUBR  81
  5191. return-from  65                         subseq  34
  5192. reverse  33                             subsetp  59
  5193. room  80                                subst  40
  5194. round  43                               SYMBOL  81
  5195. rplaca  42                              symbol-function  26, 28
  5196. rplacd  42                              symbol-name  28
  5197. satisfies  60                           symbol-plist  26, 28
  5198. save  79                                symbol-value  26, 28
  5199. search  34                              symbolp  57
  5200. second  38                              system  82
  5201. self  18, 22                            t  22
  5202. send  18, 26, 55                        tagbody  65
  5203. send-super  18, 55                      tan  45
  5204. set  26                                 tanh  46
  5205. set-difference  41                      terpri  68
  5206. set-exclusive-or  41                    third  38
  5207. set-macro-character  67                 throw  62
  5208. setf  26                                time  80
  5209. setq  26                                top-level  3, 77
  5210. signum  45                              trace  77
  5211. sin  45                                 truename  73
  5212. sinh  46                                truncate  43
  5213. some  33                                type-of  81
  5214. sort  42                                typep  60
  5215. sqrt  46                                union  41
  5216. step  84                                unless  61
  5217. strcat  50                              UNNAMED-STREAM  81
  5218. STREAM  60                              untrace  77
  5219. streamp  58                             unwind-protect  63
  5220. string  49, 81                          upper-case-p  51
  5221. string-downcase  49                     vector  32
  5222. string-equal  50                        when  61
  5223. string-greaterp  50                     with-input-from-string  75
  5224. string-left-trim  49                    with-open-file  73
  5225. string-lessp  50                        with-output-to-string  76
  5226. string-not-equal  50                    write-byte  73
  5227. string-not-greaterp  50                 write-char  71
  5228. string-not-lessp  50                    y-or-n-p  68
  5229. string-right-trim  49                   zerop  59
  5230. string-trim  49
  5231. string-upcase  49
  5232. string/=  50
  5233. string<  50
  5234. string<=  50
  5235. string=  50
  5236. string>  50
  5237. string>=  50
  5238. stringp  58
  5239.